Created
August 16, 2011 14:24
-
-
Save schappim/1149203 to your computer and use it in GitHub Desktop.
Digital Read Serial
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
/* | |
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