Advertisement
tpaper

Untitled

Apr 8th, 2014
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. void setup()
  2. {
  3. Serial.begin(9600);
  4. pinMode(13,OUTPUT);
  5. pinMode(12,INPUT);
  6. }
  7.  
  8. void loop()
  9. {
  10. if (Serial.available() > 0) {
  11. if (Serial.read() == 65) {
  12. commuta();
  13. }
  14. }
  15. if (!digitalRead(12)) {
  16. delay(100);
  17. while (!digitalRead(12));
  18. commuta();
  19. }
  20. }
  21.  
  22. void commuta() {
  23. digitalWrite(13,!digitalRead(13));
  24. Serial.print("Commuto! ");
  25. Serial.print("Adesso il LED e': ");
  26. if (digitalRead(13)) {
  27. Serial.println("Acceso");
  28. } else {
  29. Serial.println("Spento");
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement