Last active
July 10, 2018 15:29
-
-
Save li2hub/8d6fa52c8e62f20fc4a56bae2d6bbd42 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() | |
{ | |
pinMode(13, OUTPUT); // Pin 13 has an LED connected on most Arduino boards | |
pinMode(2,INPUT); //Pin 2 is connected to the output of proximity sensor | |
} | |
void loop() | |
{ | |
if(digitalRead(2)==HIGH) //Check the sensor output | |
{ | |
digitalWrite(13, HIGH); // set the LED on | |
} | |
else | |
{ | |
digitalWrite(13, LOW); // set the LED off | |
} | |
delay(100); // wait for 100ms | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment