Names make code easier to read. At the top of the program, write button = i1 to give a pin a nickname.
from tinkerpy_mega import * button = i1 led = o1 def setup(): pass # your code goes here def loop(): if read_digital(button) == ON: write_output(led, pwm(100)) else: write_output(led, 0)
๐ก Tip
In the Project editor, tap the PIN button: add or rename pin names, and Use names everywhere swaps o1/i1 for your names at once.
๐ Your turn
Name o2 buzzer and make it sound while the button is pressed.