Guest User

Untitled

a guest
Apr 16th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. int LED = 13; // Use the onboard Uno LED
  2. int isObstaclePin = 7;
  3. int isObstacle = HIGH;
  4.  
  5. void setup() {
  6. pinMode(LED, OUTPUT);
  7. pinMode(isObstaclePin, INPUT);
  8. Serial.begin(9600);
  9.  
  10. }
  11.  
  12. void loop() {
  13. isObstacle = digitalRead(isObstaclePin);
  14. if (isObstacle == LOW)
  15. {
  16. Serial.println("OBSTACLE!!, OBSTACLE!!");
  17. digitalWrite(LED, HIGH);
  18. }
  19. else
  20. {
  21. Serial.println("clear");
  22. digitalWrite(LED, LOW);
  23. }
  24. delay(200);
  25. }
Add Comment
Please, Sign In to add comment