diff --git a/src/machine/machine_esp8266.go b/src/machine/machine_esp8266.go index 78eccc05..5570e7e0 100644 --- a/src/machine/machine_esp8266.go +++ b/src/machine/machine_esp8266.go @@ -107,6 +107,15 @@ func (p Pin) Configure(config PinConfig) { } } +// Get returns the current value of a GPIO pin when the pin is configured as an +// input. +func (p Pin) Get() bool { + // See this document for details + // https://www.espressif.com/sites/default/files/documentation/esp8266-technical_reference_en.pdf + + return esp.GPIO.GPIO_IN.Get()&(1<