Created
May 4, 2021 16:53
-
-
Save fisherds/2d8632142403ef6aaeb6258960bbf076 to your computer and use it in GitHub Desktop.
Helper program I used to work out the details for my sensor methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Authors: Dave Fisher and PUT_YOUR_NAME_HERE. | |
""" | |
# TODO: 1. Put your name in the above. | |
import time | |
import rosebot | |
def main(): | |
print() | |
print(" Ultrasonic (cm) Line Sensors: Left Middle Right") | |
print("----------------- ----- ----- -----") | |
robot = rosebot.RoseBot() | |
while True: | |
print(" {:5.1f} {} {} {}".format( | |
robot.ultrasonic.get_distance(), | |
"W" if robot.line_sensors.get_left_value() == 0 else "B", | |
"W" if robot.line_sensors.get_middle_value() == 0 else "B", | |
"W" if robot.line_sensors.get_right_value() == 0 else "B")) | |
time.sleep(1) | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment