IR Obstacle Detector
How to make IR Obstacle Detector
Components and supplies
1
Jumper wires (generic)
1
Arduino UNO
1
IR obstacle sensor
1
LED
Project description
Code
Code
arduino
Comments
Only logged in users can leave comments
Components and supplies
Jumper wires (generic)
Arduino UNO
IR obstacle sensor
LED
Project description
Code
Code
arduino
1int LED = 13; 2int obstaclePin = 8; 3int hasObstacle = HIGH; 4 5void setup() 6{ 7 pinMode(LED, OUTPUT); 8 pinMode(obstaclePin, INPUT); 9 10} 11void loop() { 12 hasObstacle = digitalRead(obstaclePin); 13 if (hasObstacle == LOW) 14 { 15 16 digitalWrite(LED, HIGH); 17 } 18 else 19 { 20 21 digitalWrite(LED, LOW); 22 } 23 delay(200); 24}
Comments
Only logged in users can leave comments