daily pastebin goal
68%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top