Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SoftwareSerial.h>
- SoftwareSerial apc220(6, 7);
- const int pino_botao = 4;
- int valor_botao;
- unsigned x = 0;
- int cont =5;
- void setup() {
- Serial.begin(9600);
- apc220.begin(9600);
- pinMode(pino_botao,INPUT);
- // delay(100);
- }
- void loop(){
- if(digitalRead(4)==1){
- cont++; // atribui +1 a variavel cont
- delay(300);
- }
- if(cont==6){cont=1;} /
- if(cont==1){
- apc220.write(10);
- Serial.println (apc220);
- delay(10);
- }
- else if(cont==2){
- apc220.write(50);
- Serial.println (apc220);
- delay(10);
- }
- else if(cont==3){
- apc220.write(100);
- Serial.println (apc220);
- delay(10);
- }
- else if(cont==4){
- apc220.write(150);
- Serial.println (apc220);
- delay(10);
- }
- else if(cont==5){
- apc220.write(200);
- Serial.println (apc220);
- delay(10);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment