int knapStatus = 2;
void setup()
{
pinMode(13, OUTPUT);
pinMode (knapStatus, INPUT_PULLUP);
}
void loop()
{
int knapStatus = digitalRead(2);
if (knapStatus == HIGH) {
digitalWrite(13, LOW);
}
else {
digitalWrite(13, HIGH);
}
}
En smart måde