@@ -1,11 +1,11 @@ | |||
Adafruit-Blinka==8.16.1 | |||
adafruit-circuitpython-busdevice==5.2.4 | |||
adafruit-circuitpython-dht==3.7.8 | |||
adafruit-circuitpython-requests==1.13.1 | |||
adafruit-circuitpython-tsl2561==3.3.15 | |||
adafruit-circuitpython-typing==1.9.0 | |||
Adafruit-PlatformDetect==3.43.0 | |||
Adafruit-PureIO==1.1.10 | |||
# Adafruit-Blinka==8.16.1 # Raspy only, not possible on other devices -> commented out | |||
# adafruit-circuitpython-busdevice==5.2.4 | |||
# adafruit-circuitpython-dht==3.7.8 | |||
# adafruit-circuitpython-requests==1.13.1 | |||
# adafruit-circuitpython-tsl2561==3.3.15 | |||
# adafruit-circuitpython-typing==1.9.0 | |||
# Adafruit-PlatformDetect==3.43.0 | |||
# Adafruit-PureIO==1.1.10 | |||
certifi==2022.12.7 | |||
charset-normalizer==3.0.1 | |||
click==8.1.3 | |||
@@ -16,15 +16,16 @@ itsdangerous==2.1.2 | |||
Jinja2==3.1.2 | |||
MarkupSafe==2.1.2 | |||
paho-mqtt==1.6.1 | |||
pkg_resources==0.0.0 | |||
pyftdi==0.54.0 | |||
pyserial==3.5 | |||
pyusb==1.2.1 | |||
# pkg_resources==0.0.0 | |||
# pyftdi==0.54.0 | |||
# pyserial==3.5 | |||
# pyusb==1.2.1 | |||
requests==2.28.2 | |||
rpi-ws281x==4.3.4 | |||
RPi.GPIO==0.7.1 | |||
sysv-ipc==1.1.0 | |||
# rpi-ws281x==4.3.4 | |||
# RPi.GPIO==0.7.1 | |||
# sysv-ipc==1.1.0 | |||
typing_extensions==4.5.0 | |||
urllib3==1.26.14 | |||
Werkzeug==2.2.3 | |||
zipp==3.15.0 | |||
python-ev3dev2==2.1.0.post1 |
@@ -0,0 +1,21 @@ | |||
#!/usr/bin/env python3 | |||
from ev3dev2.motor import LargeMotor, OUTPUT_A, SpeedPercent | |||
from ev3dev2.sensor.lego import TouchSensor, UltrasonicSensor | |||
from ev3dev2.sensor import INPUT_1, INPUT_4 | |||
m = LargeMotor(OUTPUT_A) | |||
touch = TouchSensor(INPUT_1) | |||
ultraSonic = UltrasonicSensor(INPUT_4) | |||
ultraSonic.MODE_US_DIST_CM | |||
m.on(SpeedPercent(50)) | |||
while True: | |||
if ultraSonic.distance_centimeters < 10: | |||
m.on(SpeedPercent(25)) | |||
break | |||
touch.wait_for_pressed(timeout_ms=None, sleep_ms=10) | |||
m.off() | |||
@@ -6,6 +6,15 @@ from raspySensors import RaspySensors | |||
sensors = RaspySensors() | |||
#endregion | |||
#region | |||
def measureSendData(): | |||
'''Measure Data via sensor class and send via MQTT''' | |||
sensorData = sensors.readSensors() | |||
client.publish("Robot/Data", json.dumps(sensorData, indent=4)) | |||
#endregion | |||
#region MQTT callbacks | |||
@@ -14,8 +23,15 @@ def send_data_json(client, userdata, message): | |||
dataDict = json.loads(strIn) | |||
print("Received data: ", json.dumps(dataDict)) | |||
#Function for all Plants or one which changes according to request | |||
def drive_plant_1(clients, userdata, message): | |||
#TODO Start drive forward | |||
print("Driving to plant 1") | |||
measureSendData() | |||
#TODO Start Drive Back Function | |||
print("Driving back to start position") | |||
#endregion | |||