Create repo

This commit is contained in:
Γιώργος Αντρέου 2025-05-24 03:34:20 +03:00
commit 92f5354e3d
2 changed files with 15 additions and 0 deletions

1
README.md Normal file
View file

@ -0,0 +1 @@
A repository for our robot in the MRC Robotex Cyprus Rally competition. The robot uses the motor2040 controller and 2 micrometal gearmotors, with encoders attached in order to measure the distance travelled.

14
sensortest-rally.py Normal file
View file

@ -0,0 +1,14 @@
import time
import board
import adafruit_hcsr04
# Set the sensor pins
sonar = adafruit_hcsr04.HCSR04(trigger_pin=board.TRIG, echo_pin=board.ECHO)
while True:
try:
print(f"{sonar.distance:.2f}")
except RuntimeError:
print("Retrying!")
time.sleep(0.1)