Skip to content

Instantly share code, notes, and snippets.

@michaelsarduino
Created July 20, 2015 17:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelsarduino/95c117e8f1177f9633c4 to your computer and use it in GitHub Desktop.
Save michaelsarduino/95c117e8f1177f9633c4 to your computer and use it in GitHub Desktop.
int led = 13;
int opto = 7;
void setup() {
pinMode(led, OUTPUT);
pinMode(opto, INPUT);
}
void loop() {
if(digitalRead(opto) == HIGH)
{
digitalWrite(led, LOW);
}
else {
digitalWrite(led, HIGH);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment