diff --git a/ArduinoSerial/.idea/.gitignore b/ArduinoSerial/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/ArduinoSerial/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/ArduinoSerial/.idea/ArduinoSerial.iml b/ArduinoSerial/.idea/ArduinoSerial.iml new file mode 100644 index 0000000..2c80e12 --- /dev/null +++ b/ArduinoSerial/.idea/ArduinoSerial.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ArduinoSerial/.idea/inspectionProfiles/profiles_settings.xml b/ArduinoSerial/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/ArduinoSerial/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/ArduinoSerial/.idea/misc.xml b/ArduinoSerial/.idea/misc.xml new file mode 100644 index 0000000..7ae58c2 --- /dev/null +++ b/ArduinoSerial/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/ArduinoSerial/.idea/modules.xml b/ArduinoSerial/.idea/modules.xml new file mode 100644 index 0000000..b3dc4f4 --- /dev/null +++ b/ArduinoSerial/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/ArduinoSerial/main.py b/ArduinoSerial/main.py new file mode 100644 index 0000000..64ab546 --- /dev/null +++ b/ArduinoSerial/main.py @@ -0,0 +1,15 @@ +import serial # stáhnout pyserial 3.5 +import time + +ser = serial.Serial("COM3",9600) # COM# z arduino IDE kde máte zapojený arduino + +while True: + line = ser.readline().decode("utf-8").strip() + + sensor_name, sensor_value = line.split(":") + + print(f"Nazev senzoru: {sensor_name}") + print(f"Hodnota senzoru: {sensor_value}") + print("---------------------") + + time.sleep(1) \ No newline at end of file diff --git a/ArduinoSerial/plot.py b/ArduinoSerial/plot.py new file mode 100644 index 0000000..1f910e8 --- /dev/null +++ b/ArduinoSerial/plot.py @@ -0,0 +1,23 @@ +import serial +import matplotlib.pyplot as plt + +ser = serial.Serial("COM3", 9600) + +num_values = int(input("kolik dat načíst?")) + +values = [] + +while True: + for i in range(num_values): + line = ser.readline().decode("utf-8").strip() + name, value = line.split(":") + values.append(int(value)) + print(i) + + plt.plot(values) + plt.show() + + values = [] + + if input("q?") == "q": + break diff --git a/textak.txt b/textak.txt index e19b1c0..719ead2 100644 --- a/textak.txt +++ b/textak.txt @@ -1 +1,6 @@ -NADPIS \ No newline at end of file +NADPIS + +lorem +ipsum + +THE END \ No newline at end of file