I need some 'splaining re: Reference > Language > Functions > Communication > Serial
- Is the buffer parameter in Serial.readBytes() and Serial.readBytesUntil() the same as array? So if I already declared char message[6] = "hello"; and had "imbecile\n" waiting in the serial port when Serial.readBytes(message); is called, what happens? Does message remain 6 bytes in size as it was declared, and so now it holds "imbec\n" (the first 5 characters from the serial port plus the null terminating character that is required when declaring an array of type char)? If Serial.readBytes(message); is called again, when the 4th character pulled off the serial port turns out to be the \n {which is then discarded}, would message then return with "ile\n"? Is message now only 4 bytes in size, or does it stay 6 bytes with the last 2 bytes left-over from before: "ile\nc\n"
- Is the terminator parameter in Serial.readStringUntil() the same as the character parameter in Serial.readBytesUntil() ? Both parameters say ,"the character to search for. Allowed data types: char." I confuse because I wouldn't give 2 different names to a parameter which does the same exact thing. And the use of the word "terminator" seems a poor choice when your char array (which is now called a buffer?) ALSO has a terminating character!
(So I don't commit an "XY question" faux pas:)
What I am trying to ultimately do is in dealing with the IRremote library. I took this code from the IRrecvDemo example:
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
irrecv.resume();
I want to take the signal sent by my TV remote, and which was just read by the module irrecv.enableIRIn() and stored in results.value (or is it &results ?) and NOT do a Serial.println, but instead store it in a variable of my choosing (to be checked against a list of codes which will correspond to some preset macros) and then send the data over the serial bus in binary form using **Serial.write() ** If my remote uses 32 bit codes, instead of the 8 character hex transmission I can just send 4 bytes in binary form. I suspect that all the extra code needed to save 4 bytes sent out the serial port may cost more than it saves, but I really want to do it this way because it's what I'm already familiar with. (kind of like a "hello world" example) Once I have my old way working fine, then I may try to stretch myself and learn new things. But for now I just want to straighten out what I have experience with.
Thanks in advance to anyone ambitious enough to explain this to my sick mind!

