๐ Wiring
Connect a push button to input i1 and an LED to output o1.
if asks a question. When the answer is yes, the lines indented under it run. else runs when the answer is no.
from tinkerpy_mega import * def setup(): pass # your code goes here def loop(): if read_digital(i1) == ON: write_output(o1, pwm(100)) else: write_output(o1, 0)
๐ก Tip
Notice the 4 spaces before the lines inside if and else. That is how TinkerPy knows which lines belong together.
๐ Your turn
Add a second LED on o2 that is ON when the button is not pressed.