// ESP-01S_tx_input.ino // sets TX as an input to control blue led on ESP-01S /* (c)2021 Forward Computing and Control Pty. Ltd. NSW Australia, www.forward.com.au This code is not warranted to be fit for any purpose. You may only use it at your own risk. This generated code may be freely used for both private and commercial use provided this copyright is maintained. */ int led_pin = 2; // GPIO2 for led on ESP-01S void setup() { pinMode(1, INPUT); // re-assign GPIO1 as input pinMode(led_pin, OUTPUT); digitalWrite(led_pin, HIGH); // LED OFF } void loop() { if (digitalRead(1) == LOW) { digitalWrite(led_pin, LOW); // LED ON } else { digitalWrite(led_pin, HIGH); // LED OFF } }