Skip to content

Instantly share code, notes, and snippets.

@tuttelikz
Created March 12, 2018 11:16
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 tuttelikz/b400076aed0de819e1ea031f678cb909 to your computer and use it in GitHub Desktop.
Save tuttelikz/b400076aed0de819e1ea031f678cb909 to your computer and use it in GitHub Desktop.
Snippet to receive digital value from sensor and print
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:
int sensorValue = digitalRead(ProxSensor);
Serial.println(sensorValue);
delay(100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment