Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int LED = 13; // Use the onboard Uno LED
- int isObstaclePin = 7;
- int isObstacle = HIGH;
- void setup() {
- pinMode(LED, OUTPUT);
- pinMode(isObstaclePin, INPUT);
- Serial.begin(9600);
- }
- void loop() {
- isObstacle = digitalRead(isObstaclePin);
- if (isObstacle == LOW)
- {
- Serial.println("OBSTACLE!!, OBSTACLE!!");
- digitalWrite(LED, HIGH);
- }
- else
- {
- Serial.println("clear");
- digitalWrite(LED, LOW);
- }
- delay(200);
- }
Add Comment
Please, Sign In to add comment