Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dddcfd0

Browse files
committed
Merge pull request #2 from ch-aurich/master
improved stability on my ubuntu system
2 parents abae764 + 65aab36 commit dddcfd0

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

‎arduino/arduino.py‎

Lines changed: 1 addition & 0 deletions
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‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ void loop() {
3333
analogWrite(readData(), readData()); break;
3434
case 4 :
3535
//read analog value
36-
Serial.println(analogRead(readData()));
36+
Serial.println(analogRead(readData())); break;
37+
case 99:
38+
//just dummy to cancel the current read, needed to prevent lock
39+
//when the PC side dropped the "w" that we sent
40+
break;
3741
}
3842
}
3943

@@ -44,4 +48,4 @@ char readData() {
4448
return Serial.parseInt();
4549
}
4650
}
47-
}
51+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /