From 82e37fec979a3b453b5e5c89208c9ba755f04836 Mon Sep 17 00:00:00 2001 From: Leo Marche Date: Mon, 9 Jan 2023 00:45:45 +0100 Subject: [PATCH] better README and code --- README.md | Bin 67 -> 2274 bytes mushroom_controller.py | 23 ++++++++--------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index c120f1e1372907e0261b443165d4cd2d76765d7d..188fffa227c3f49c6f94b1b6ad1ad8dd7d553b7d 100644 GIT binary patch literal 2274 zcmbW2OK;Oq5QS%r#DB2VEkpu#>`+%-QH3Cum77=H<|W5TDL)=K-;9UbB#l&|C~S!-*3mim8VGi!9ev`4FTo!VP_0;(WBsnI zQ)Htn&pJg-`zI6sx6<#__&?G5Ogma#*E*T&wSBcqT{pU0+r6U3%2C;SeKR{x7Wzbn zQ_PjkefOiIm}}=$X!gznd@HeGrL)05CWjb<7aU;lsPjMs|IS%`_I+R)_!&G;CPYod zhTW+NY|$-tZ0zY-e5<@$WxrKSs}IjM+8umzC%Z57sqCBLI_2MZM%J$!Cpr?1ik+W4 z_sCL%qA7~PsMVr{g+tw_|60`m zF+KoWtvV75S~Q|Qfj7NE-P-=yjYrj9(OUTjI)Od#{^*FlYh|H)wIU0eQWwrbm*Z28 z>xAJg8QMq@dp$#`TJE7ADrZnsIPQ%b$BOey54EmoII`)p+`0?19#Jv+vv!7Y z?n2x+F?}EIp~73OheKhJN-;-Py2CY`*7n-uDgTQVw~&LbdGdc~i~iJsZ}iP^O)q<2 zWYnmiROjN#{3+87?lHHPVs@`P_`f_UX3m#s)_C=^JEG21q>*lW*L31a8nyx z)Md7E*4FtkRnBK0yXIq^j+1a`$ra88d${>|4_s@mRPL*_T=Vd%vubh2vDEiC_hFCY zDLewALng3>Gu?z^0xy&FuE!ZpM~Cn}Qz%cP-x}SKH*{vwr9;wdr~MW)H@y&!87j-` zCUbh{T;9MJQwXGo??@Oggz;8<=x5Yp-khr{IxxXu$rRzuQAsZpi5Zyhou!=fToK|< z)!@wX#-eA#!OUAa8I^ze8R%F#n)!6-+Y&z(8r~OI{f>q16V=P?J4Hrir}k6Kc$Z|Q Y$Btp+xu{|Aj|oB_9lwiCyJ28|0od4)9{>OV delta 27 icmaDP=sZDBR9PXnv^b+EKR>rPJ}t8-w>+^Zl?wohDhdDq diff --git a/mushroom_controller.py b/mushroom_controller.py index c16a752..b7a076b 100644 --- a/mushroom_controller.py +++ b/mushroom_controller.py @@ -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"