On bluetooth from one arduino to another a string is transmitted. The second Arduinka accepts this string byte-by-byte and sends the port to the serial as well. It turns out one or two characters on the line. How to fully assemble a string in order to further perform some actions with it? In the passed string, did end-of-line pointers, in this case left "\n" . I tried this option, but at the output I get all the same some kind of nonsense and not always my “flag” is noticed, it seems to trigger on it, but sometimes it slips into the port monitor when I watch
char buffer[100]; int i; for(i=0;i<100;i++) { buffer[i]=Serial.Read(); Serial.flush(); if(buffer[i]=='\n') break; }
Serial.flush()is almost certainly superfluous ... ifSerial.Read()reads one byte from the bluetooth uart, then otherwise everything is fine ... from the common rake, I can assume that after the cycle into the line the final zero is not added ... - Fat-Zerflushnot necessary and the fact that Read is written with a capital letter) ... maybe something is wrong with the transfer or with the reception further on the code ... - Fat-Zer