Skip to content

Commit

Permalink
better README and code
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoMarche committed Jan 8, 2023
1 parent ba4138c commit 82e37fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
Binary file modified README.md
Binary file not shown.
23 changes: 8 additions & 15 deletions mushroom_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,16 @@
import serial.tools.list_ports
import time

def get_ports():
ports = serial.tools.list_ports.comports(include_links=False)
if len(ports) == 0:
raise Exception('failed to find a port')
return ports
PORT = "COM12"

def get_connection():
ports = get_ports()

for port in ports:
try:
ser = serial.Serial("COM12", baudrate=9600, timeout=10)
time.sleep(5)
return ser
except Exception as e:
print(e)
continue
global PORT
try:
ser = serial.Serial(PORT, baudrate=9600, timeout=10)
time.sleep(5)
return ser
except Exception as e:
print(e)

def set_temperature(conn, temp):
to_send = '1 '+str(temp)+"\r\n"
Expand Down

0 comments on commit 82e37fe

Please sign in to comment.