mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-03 14:24:15 +01:00
35777612c0
All examples in /build/shared/examples/ and /libraries/ have had their extensions changed to .ino
20 lines
295 B
C++
20 lines
295 B
C++
/*
|
|
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);
|
|
}
|
|
|
|
|
|
|