Skip to content

Commit 29cf16b

Browse files
committed
quickhack: improved stability, had lockups befor this change - now the python module sends out a command that causes the loop to start again - including sending a new request
1 parent abae764 commit 29cf16b

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

arduino/arduino.py

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class Arduino(object):
88

99
def __init__(self, port, baudrate=115200):
1010
self.serial = serial.Serial(port, baudrate)
11+
self.serial.write('99')
1112

1213
def __str__(self):
1314
return "Arduino is on port %s at %d baudrate" %(self.serial.port, self.serial.baudrate)

prototype.pde

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ void loop() {
3434
case 4 :
3535
//read analog value
3636
Serial.println(analogRead(readData()));
37+
case 99:
38+
//just dummy to cancel the current read, needed to prevent lock when the PC side
39+
//dropped the "w" that we sent
40+
break;
3741
}
3842
}
3943

0 commit comments

Comments
 (0)