]> git.piffa.net Git - sketchbook_andrea/blob - oggi/switch_test_serial/switch_test_serial.ino
oggi
[sketchbook_andrea] / oggi / switch_test_serial / switch_test_serial.ino
1 /*
2  * Switch test program
3  */
4
5 int switchPin = 2;              // Switch connected to digital pin 2
6
7 void setup()                    // run once, when the sketch starts
8 {
9   Serial.begin(9600);           // set up Serial library at 9600 bps
10   pinMode(switchPin, INPUT);    // sets the digital pin as input to read switch
11 }
12
13
14 void loop()                     // run over and over again
15 {
16   Serial.print("Read switch input: ");
17   Serial.println(digitalRead(switchPin));    // Read the pin and display the value
18   delay(200);
19 }