SPIKE Prime Tutorial 1.6: Distance Sensor
Engineering with Bricks
0:00 / 0:00
SPIKE Prime Tutorial 1.6: Distance Sensor
29 165 просмотров · 6 лет назад
Engineering with Bricks
3,19 тыс. подписчиков
29 165 просмотров · 6 лет назад
0:00 Overview
0:29 Blocks: Starting Motors
1:44 Blocks: Stopping motors
3:06 Python: Distance Closer Than
4:28 Python: Start/Stop based on Distance
SPIKE Prime Tutorials playlist: • SPIKE Prime Tutorials
👦 Video Created by Summer 2020 Multimedia Team (Jared Jaramillo, Hyejin Im)
🔎 Visit Us: http://www.legoengineering.com/
🔗 Tufts CEEO: https://ceeo.tufts.edu/
🎵 Music: https://www.bensound.com/
💻 Python Code
YouTube doesn't allow angled brackets, so in the "elif" statement make sure to replace the text with the correct symbols!
--------------------------------------------------------------------------------
while True:
dist_cm = distance_sensor.get_distance_cm()
if dist_cm == None:
motor.start()
elif dist_cm (greater than or equal to) 10:
motor.start()
else:
motor.stop()
--------------------------------------------------------------------------------