Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void setup() {
- // initialize digital pin 13 as an output.
- pinMode(13, OUTPUT); // this is the blue led
- pinMode(10, INPUT); // this is the IR sensor's O/P
- }
- // the loop function runs over and over again forever
- void loop() {
- digitalWrite(13, HIGH); // first I give HIGH voltage to the blue LED
- if(digitalRead(10) == LOW){ // when the voltage of the IR sensor decreases
- digitalWrite(13, LOW); // the blue LED should switch off or have 0 Voltage
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement