]> git.piffa.net Git - arduino/blob - books/ArduinoNextSteps-master/ArduinoNextSteps/sketch_01_04_serial/sketch_01_04_serial.ino
first commit
[arduino] / books / ArduinoNextSteps-master / ArduinoNextSteps / sketch_01_04_serial / sketch_01_04_serial.ino
1 // sketch 01_04_serial
2 int switchPin = 7;
3
4 void setup()
5 {
6   pinMode(switchPin, INPUT_PULLUP);
7   Serial.begin(9600);
8 }
9
10 void loop()
11 {
12   if (digitalRead(switchPin) == LOW)
13   {
14     Serial.println("Paperclip connected");
15   }
16   else
17   {
18     Serial.println("Paperclip NOT connected");
19   }
20   delay(1000);
21 }
22