diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index dc9ea49..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/projektarbeit_duelger_waldhauser_caliskan.iml b/.idea/projektarbeit_duelger_waldhauser_caliskan.iml index d0876a7..43f86f1 100644 --- a/.idea/projektarbeit_duelger_waldhauser_caliskan.iml +++ b/.idea/projektarbeit_duelger_waldhauser_caliskan.iml @@ -2,7 +2,6 @@ - \ No newline at end of file diff --git a/README.md b/README.md index 3415b2d..f5f5bf0 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ # projektarbeit_duelger_waldhauser_caliskan -repository to manage all files related to the makeathon farm bot project (Software + Documentation). \ No newline at end of file +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 \ No newline at end of file diff --git a/documentation/conda-cheatsheet.pdf b/documentation/conda-cheatsheet.pdf new file mode 100644 index 0000000..6246311 Binary files /dev/null and b/documentation/conda-cheatsheet.pdf differ diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000..1690642 Binary files /dev/null and b/environment.yml differ diff --git a/software/backend/mqtt_client_basic.py b/software/backend/mqtt_client_basic.py new file mode 100644 index 0000000..56652d0 --- /dev/null +++ b/software/backend/mqtt_client_basic.py @@ -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)""" diff --git a/software/test.txt b/software/test.txt deleted file mode 100644 index 9033296..0000000 --- a/software/test.txt +++ /dev/null @@ -1 +0,0 @@ -hallo \ No newline at end of file