You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
394 B
C++
22 lines
394 B
C++
/*
|
|
DigitalReadSerial
|
|
Reads a digital input on pin 2, prints the result to the serial monitor
|
|
*/
|
|
|
|
// digital pin 2 has a pushbutton attached to it. Give it a name:
|
|
int pushButton = 7;
|
|
|
|
void setup() {
|
|
Serial.begin(9600);
|
|
pinMode(pushButton, INPUT);
|
|
}
|
|
|
|
void loop() {
|
|
int buttonState = digitalRead(pushButton);
|
|
//if(buttonState == 1)
|
|
//{
|
|
Serial.println("a");
|
|
//}
|
|
delay(1000);
|
|
}
|