Advertisement
Guest User

Untitled

a guest
Oct 21st, 2017
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <SoftwareSerial.h>
  2. int bluetoothTx = 6;
  3. int bluetoothRx = 7;
  4.  
  5. SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);
  6.  
  7. void setup() {
  8. bluetooth.begin(9600);
  9. Serial.begin(9600);
  10. }
  11.  
  12. void loop() {
  13. if(bluetooth.available()>0)
  14. {
  15. unsigned int blue = bluetooth.read();
  16. if(blue == 2)
  17. {
  18. Serial.println("Liga");
  19. delay(500);
  20. }
  21. if(blue == 1)
  22. {
  23. Serial.println("Desliga");
  24. delay(500);
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement