I am trying to sent data to an Arduino Nano via serial using python, but it doesn't work yet. Is there a way to ensure that what I am trying to send was sent? (This is in order to understand where the problem is - in the sending, or in the receiving).
The python code:
import serial
ser = serial.Serial('/dev/ttyAMA0', 9600, timeout=1)
ser.write("testing".encode())
try:
while 1:
response = ser.readline()
print (response)
except KeyboardInterrupt:
ser.close()
The Arduino code:
void setup() {
Serial.begin(9600);
}
void loop() {
if (Serial.available() > 0) {
int incoming = Serial.read();
Serial.print("Character recieved: ");
Serial.print(incoming, DEC);
}
}