import time
import machine
DELAY = 1
CLOCK_PIN = machine.Pin(20, machine.Pin.OUT)
BTN = machine.Pin(5, machine.Pin.IN, machine.Pin.PULL_UP)
DATA_PIN = machine.Pin(21, machine.Pin.OUT)
clock_signal = True
while True:
clock_signal = not clock_signal
CLOCK_PIN.value(clock_signal)
if BTN.value() == 1: # pull-up => high => btn no press
print("Button high")
DATA_PIN.value(False)
else: # pull-up => low => btn pressed
print("Button low")
DATA_PIN.value(True)
time.sleep(DELAY)
ERC Warnings
flop1:CLK: Clock driven by combinatorial logic
flop2:CLK: Clock driven by combinatorial logic
flop3:CLK: Clock driven by combinatorial logic
flop4:CLK: Clock driven by combinatorial logic