Skip to content

Instantly share code, notes, and snippets.

@bevchou
Created September 27, 2017 01:36
Show Gist options
  • Save bevchou/d939ab704b61ebc9a6361a665d600af9 to your computer and use it in GitHub Desktop.
Save bevchou/d939ab704b61ebc9a6361a665d600af9 to your computer and use it in GitHub Desktop.
First iteration of code to get LED to light up
int LED1Pin = 4;
int switchPin = 7;
void setup(){
pinMode(switchPin, INPUT);
pinMode(LED1Pin, OUTPUT);
Serial.println(switchPin);
}
void loop(){
//read input
int switchState = digitalRead(switchPin);
Serial.println(switchState);
if (switchState == HIGH){
digitalWrite(LED1Pin, HIGH);
} else{
digitalWrite(LED1Pin, LOW);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment