I am getting random(ish) results when writing to Serial1... the board is a Leonardo to a standard 340 usb converter this is connected to pins 0 & 1. I know I am writing ASCII data... just using Hex to understand it!
The code;
int a=0;
void setup() { Serial1.begin(9600); }
void loop() {
while (a<10) {
Serial1.print(a);
Serial.print(a);
Serial1.print(",");
Serial.print(",");
a++;
}
Serial.println();
Serial1.println();
delay(1000);
a=0;
}
Serial via USB is automatically initialized on boot, only serial1 needs to be initialized. serial via usb is fine anyway.
So one might expect the same results from both channels... so I thought...
Using 'simple term gold'
output from USB (serial): 0,1,2,3,4,5,6,7,8,9,<0D><0A> that's all good
for reference the hex is: 30 2C 31 2C 32 2C 33 2C 34 2C 35 2C 36 2C 37 2C 38 2C 39 2C 0D 0A
then from 'serial1' - the 'hardware serial port
76 EB A7 9B A7 99 A7 97 A7 95 A7 93 A7 91 A7 8F A7 8D A7 E5 EB 00
my first instinct was try different baud rates... no, both term and arduino are set to 9600.
then I remembered about bit inversion in RS232, so I tried that and the results are:
89 14 58 64 58 66 58 68 58 6A 58 6C 58 6E 58 70 58 72 58 1A 14 FF
Since both are from the same terminal program, I am thinking about the arduino, the rs232 -> usb converter is working it seems.
Have I missed something?
I did search, here and google, but nothing came near my issue...
BTW it is a genuine board, not a random clone!
Thanks in advance