LucasEloi

transmissor

May 10th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <SoftwareSerial.h>
  2.  
  3. SoftwareSerial apc220(6, 7);
  4. const int pino_botao = 4;
  5. int valor_botao;
  6. unsigned x = 0;
  7. int cont =5;
  8.  
  9.  
  10. void setup() {
  11. Serial.begin(9600);
  12. apc220.begin(9600);
  13. pinMode(pino_botao,INPUT);
  14. // delay(100);
  15. }
  16.  
  17. void loop(){
  18.  
  19. if(digitalRead(4)==1){  
  20.     cont++;  // atribui +1 a variavel cont
  21.     delay(300);
  22.  }
  23.  if(cont==6){cont=1;}   /
  24.  
  25.  
  26.  if(cont==1){
  27.  apc220.write(10);
  28. Serial.println (apc220);
  29. delay(10);
  30.  }
  31.  else if(cont==2){
  32.   apc220.write(50);
  33. Serial.println (apc220);
  34. delay(10);
  35.  }
  36.  else if(cont==3){
  37.   apc220.write(100);
  38. Serial.println (apc220);
  39. delay(10);
  40.  }
  41.  else if(cont==4){
  42.   apc220.write(150);
  43. Serial.println (apc220);
  44. delay(10);
  45.  }
  46.  else if(cont==5){
  47.   apc220.write(200);
  48. Serial.println (apc220);
  49. delay(10);
  50.  }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment