This robot will chase after you using the Ultrasonic sensor. Once it get's close... tag you are it! Then it will run away.
Video DemonstrationThe code is based on the starter tutorials from the Hackster missions.
All code is available at my github repo at https://github.com/QueenBeauty2312/tag-youre-it
One key part of the code is looping until we are close to the target.
print("Ultrasonic " + str(us.distance_centimeters))
if us.distance_centimeters < 40*1.4: # to detect objects closer than about 40cm
My first idea was to use the infrared beacon and have the robot chase the beacon. Bummer, we forgot the beacon at school before winter break. So we went with the ultrasonic sensor to sense the person is close.
Comments