Advertisement
mroznai

Untitled

Aug 12th, 2019
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 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. pinMode(ledPin, OUTPUT); // sets the digital pin 13 as output
  7. pinMode(inPin, INPUT); // sets the digital pin 7 as input
  8. }
  9.  
  10. void loop() {
  11. val = digitalRead(inPin); // read the input pin
  12. digitalWrite(ledPin, val); // sets the LED to the button's value
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement