Skip to content

Instantly share code, notes, and snippets.

@michalvalasek
Created March 19, 2012 18:12
Show Gist options
  • Save michalvalasek/2122329 to your computer and use it in GitHub Desktop.
Save michalvalasek/2122329 to your computer and use it in GitHub Desktop.
Arduino Lamer #2
const int LED = 13;
const int SENSOR = 4;
int val = 0;
void setup()
{
pinMode(LED, OUTPUT);
pinMode(SENSOR, INPUT);
}
void loop()
{
val = digitalRead(SENSOR);
if (val==HIGH) {
digitalWrite(LED, HIGH);
}
else {
digitalWrite(LED, LOW);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment