Skip to content

Instantly share code, notes, and snippets.

@giljr
Created December 2, 2018 01:38
Show Gist options
  • Save giljr/f27607c763bbb4741e3e6f15a485e12c to your computer and use it in GitHub Desktop.
Save giljr/f27607c763bbb4741e3e6f15a485e12c to your computer and use it in GitHub Desktop.
Arduino UNO — Quick Intro A Workshop in BSB with the Kids :) https://medium.com/kidstronics/arduino-uno-quick-intro-94c7c682740a
/*
Kids-Serie#10
Project : Arduino Start Up
Ino File: _10_PushButton_02.ino
*/
void setup() { // put your setup code here, to run once:
pinMode(3, OUTPUT); // LED connected
pinMode(7, INPUT); // Push Button connected
}
void loop() { // put your main code here, to run repeatedly:
if (digitalRead(7) == HIGH) { // is button pressed?
digitalWrite(3, HIGH); // yes, then light LED
} else {
digitalWrite(3, LOW); // no, turn off the led ;)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment