Created
March 12, 2018 11:18
-
-
Save tuttelikz/562e2ebb221478100b1cd84413b7416d to your computer and use it in GitHub Desktop.
Snippet to on/off from sensor receiving
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
const int ProxSensor = 2; | |
void setup() { | |
// put your setup code here, to run once: | |
pinMode(13, OUTPUT); | |
pinMode(ProxSensor,INPUT); | |
Serial.begin(9600); | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
if (digitalRead(ProxSensor) == HIGH) { | |
digitalWrite(13, HIGH); | |
} else { | |
digitalWrite(13, LOW); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment