Code: Select all
from machine import Pin
import utime
led = Pin("LED", Pin.OUT)
button = Pin(15, Pin.IN)
while True:
print(button.value())
if button.value()==1:
led.toggle()
utime.sleep(0.2)
I guess I have misunderstood something, but I thought that the Pin only gets activated when 3V flows through them and the 3V3 provides the pin with these 3V. I only have to close and open the circuit with a button to send multiple signals.
What would I have to do to make the LED toggle when a button is pressed?