some initial files loaded

This commit is contained in:
caliskanbi 2023-03-30 12:49:37 +02:00
parent 6825722862
commit 9aac11aae3
7 changed files with 33 additions and 7 deletions

4
.idea/misc.xml generated
View File

@ -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>

View File

@ -2,7 +2,6 @@
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -1,3 +1,6 @@
# projektarbeit_duelger_waldhauser_caliskan
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

Binary file not shown.

BIN
environment.yml Normal file

Binary file not shown.

View 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)"""

View File

@ -1 +0,0 @@
hallo