Advertisement
Guest User

code

a guest
Mar 3rd, 2012
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. int ledPin = 13; // LED connected to digital pin 13
  2. int inPin = 7;   // pushbutton connected to digital pin 7
  3. int val = 0;     // variable to store the read value
  4.  
  5. void setup()
  6. {
  7.   pinMode(ledPin, OUTPUT);      // sets the digital pin 13 as output
  8.   pinMode(inPin, INPUT);      // sets the digital pin 7 as input
  9. }
  10.  
  11. void loop()
  12. {
  13.   val = digitalRead(inPin);   // read the input pin
  14.   digitalWrite(ledPin, val);    // sets the LED to the button's value
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement