I want to send values from a Python program on a Raspberry Pi to an Arduino. My RPi program looks like that:
import time, serial
time.sleep(3)
ser = serial.Serial('/dev/ttyACM0', 9600)
ser.write(b'5')
My Arduino program:
void setup() {
Serial.begin(9600); // set the baud rate
Serial.println("Ready"); // initial "ready" signal
}
void loop() {
char inByte = ' ';
if(Serial.available()) {
inByte = Serial.read();
Serial.println(inByte);
}
delay(100)
}
My problem is that when I run the program in Python and afterwards open the serial monitor in the Arduino IDE, it only shows "ready", but not the sent value. If I want to have the monitor open at the same time as the program, there is the error:
Device or resource busy: '/dev/ttyACM0'
I am using Python 3.6 by the way.
I am sorry if this is an easy error, but I am very new to serial and Arduino.
println
? – Easton Bornemeier