๐ Wiring
The ultrasonic sensor always uses i3 and i4. Put an LED on o1.
Add from ultrasonic import *. Then distance() gives you the distance in centimetres.
from tinkerpy_mega import * from ultrasonic import * def setup(): pass # your code goes here def loop(): if distance() < 20: write_output(o1, pwm(100)) else: write_output(o1, 0)
๐ Your turn
Add a buzzer on o2 that beeps when something is closer than 10 cm.