Created
September 27, 2017 01:36
-
-
Save bevchou/d939ab704b61ebc9a6361a665d600af9 to your computer and use it in GitHub Desktop.
First iteration of code to get LED to light up
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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