Advertisement
Guest User

arducar

a guest
Jan 21st, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. int control=2;
  2. char procitan=0;
  3. void setup() {
  4. // initialize digital pin 13 as an output.
  5. pinMode(control, OUTPUT);
  6. Serial.begin(9600);
  7. }
  8.  
  9. // the loop function runs over and over again forever
  10. void loop() {
  11.  
  12. while (Serial.available())
  13. {
  14. procitan=Serial.read();
  15. if(procitan=='w')
  16. {
  17. digitalWrite(control, HIGH);
  18. Serial.println("High");
  19. }
  20.  
  21. if(procitan=='a')
  22. {
  23. digitalWrite(control, LOW);
  24. Serial.println("low");
  25.  
  26. }
  27. if(procitan=='q')
  28. {
  29.  
  30. digitalWrite(control, HIGH);
  31. delay(2000);
  32. digitalWrite(control, LOW);
  33. Serial.println("low");
  34.  
  35. }
  36.  
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement