some initial files loaded
This commit is contained in:
parent
6825722862
commit
9aac11aae3
4
.idea/misc.xml
generated
4
.idea/misc.xml
generated
@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10" project-jdk-type="Python SDK" />
|
|
||||||
</project>
|
|
@ -2,7 +2,6 @@
|
|||||||
<module type="PYTHON_MODULE" version="4">
|
<module type="PYTHON_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$" />
|
<content url="file://$MODULE_DIR$" />
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
@ -1,3 +1,6 @@
|
|||||||
# projektarbeit_duelger_waldhauser_caliskan
|
# projektarbeit_duelger_waldhauser_caliskan
|
||||||
|
|
||||||
repository to manage all files related to the makeathon farm bot project (Software + Documentation).
|
repository to manage all files related to the makeathon farm bot project (Software + Documentation).
|
||||||
|
|
||||||
|
To use the same module versions in backend and raspi communication, a conda environment was created
|
||||||
|
Basic conda usages: https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html
|
BIN
documentation/conda-cheatsheet.pdf
Normal file
BIN
documentation/conda-cheatsheet.pdf
Normal file
Binary file not shown.
BIN
environment.yml
Normal file
BIN
environment.yml
Normal file
Binary file not shown.
29
software/backend/mqtt_client_basic.py
Normal file
29
software/backend/mqtt_client_basic.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import paho.mqtt.client as mqtt
|
||||||
|
|
||||||
|
|
||||||
|
def on_connect(_client, userdata, flags, rc):
|
||||||
|
print("Connected with result code " + str(rc))
|
||||||
|
client.subscribe("test/topic")
|
||||||
|
|
||||||
|
|
||||||
|
def on_message(_client, userdata, msg):
|
||||||
|
print(msg.topic + " " + str(msg.payload))
|
||||||
|
|
||||||
|
|
||||||
|
client = mqtt.Client()
|
||||||
|
client.on_connect = on_connect
|
||||||
|
client.on_message = on_message
|
||||||
|
|
||||||
|
client.connect("localhost", 1883, 60)
|
||||||
|
|
||||||
|
client.loop_forever()
|
||||||
|
|
||||||
|
"""In this example, we create a new instance of the mqtt.Client class and set up the on_connect and on_message
|
||||||
|
callback functions. The on_connect function is called when the client successfully connects to the broker,
|
||||||
|
and the on_message function is called when a message is received on a subscribed topic.
|
||||||
|
|
||||||
|
Then, we call the connect method to connect to the MQTT broker running on the local machine on port 1883, and set the
|
||||||
|
keepalive value to 60 seconds.
|
||||||
|
|
||||||
|
Finally, we call the loop_forever method to start the client and begin processing incoming messages. This method
|
||||||
|
blocks the program execution and runs the client loop in a loop until the client is disconnected. (ChatGPT)"""
|
@ -1 +0,0 @@
|
|||||||
hallo
|
|
Loading…
x
Reference in New Issue
Block a user