I'm sending some commands from my computer to my Arduino Mega and vice-versa. I'm testing with Tera Term right now and running into a weird problem. This problem is with sending data from my Arduino to my computer using Serial.write. In particular, trying to send an array of characters or even an individual character from an array. Neither will show up in Tera Term, even though sending an individual char variable or chars or arrays of chars using "" works just fine. I thought I was following correctly the instructions on the Serial.write descriptor page, but something is off.
I don't have a problem sending individual characters.
char command = 'A'; Serial2.write(comm);
This works just fine and shows up in tera term without a problem.
char response = "ML"; Serial2.write(response); //my first variant just trying to send a single char from the array Serial2.write(response); //my second variant after rereading the Serial.write page Serial2.write(response, 3); //a final variant Serial2.write("ML");
Passing in the array name (my first try) doesn't work, and passing in the first character (my first variant) does not work. Nothing shows up in tera term. My final variant does work.
Does anyone know the proper way to send an array of characters from my Arduino to my computer? Thanks!