// Demonstration of the following: // 1. digitalRead() from external switch // 2. digitalWrite() to external LED const int SWITCH_PIN = 8; const int LED_PIN = 4; void setup() { Serial.begin(115200); pinMode(LED_PIN, OUTPUT); pinMode(SWITCH_PIN, INPUT); } void loop() { int value = digitalRead(SWITCH_PIN); Serial.println(value); digitalWrite(LED_PIN, value); delay(50); }