Skip to content

Instantly share code, notes, and snippets.

@schappim
Created August 16, 2011 14:24
Show Gist options
  • Save schappim/1149203 to your computer and use it in GitHub Desktop.
Save schappim/1149203 to your computer and use it in GitHub Desktop.
Digital Read Serial
/*
DigitalReadSerial
Reads a digital input on pin 2, prints the result to the serial monitor
This example code is in the public domain.
*/
void setup() {
Serial.begin(9600);
pinMode(2, INPUT);
}
void loop() {
int sensorValue = digitalRead(2);
Serial.println(sensorValue, DEC);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment