-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
Hello,
I'm trying to work with getting python code to write strings over the Serial link over time.
I've set up a loop that looks like this:
while True:
avr.run()
r, w, x = select.select([sys.stdin], [], [], 0)
if r:
line = sys.stdin.readline()
avr.uart.send_string(line+"\n")
This works for a short period of time, but, if i wait to type input or try again later, it is never delivered to the arduino.
the arduino code looks like:
void loop() {
Serial.print("Looping.\\n");
Serial.print("Enter Value: \\n");
while(1) {
while (Serial.available() > 0) {
char recieved = Serial.read();
// Process message when new line character is recieved
if (recieved == '\\n') {
Serial.println(inData);
inData = ""; // Clear recieved buffer
} else {
inData += recieved;
}
}
Am i missing something? is there a better way to serial write to the arduino sim?
gabe
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels