23 lines
244 B
C++
23 lines
244 B
C++
|
|
const int Pin = 2;
|
|
|
|
void setup() {
|
|
Serial.begin(9600);
|
|
|
|
}
|
|
|
|
void loop() {
|
|
|
|
int port = digitalRead(Pin); //считываем состояние порта
|
|
|
|
if(port == LOW)
|
|
{
|
|
Serial.print("0");
|
|
} else
|
|
Serial.print("1");
|
|
|
|
|
|
delay(500);
|
|
|
|
}
|