Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. void setup() {
  2. // initialize digital pin 13 as an output.
  3. pinMode(13, OUTPUT); // this is the blue led
  4. pinMode(10, INPUT); // this is the IR sensor's O/P
  5.  
  6. }
  7.  
  8. // the loop function runs over and over again forever
  9. void loop() {
  10. digitalWrite(13, HIGH); // first I give HIGH voltage to the blue LED
  11.  
  12. if(digitalRead(10) == LOW){ // when the voltage of the IR sensor decreases
  13. digitalWrite(13, LOW); // the blue LED should switch off or have 0 Voltage
  14. }
  15.  
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement