A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

New answers tagged

2

The function I think you are looking for is strlen - STRing LENgth. It counts the number of characters in a string up until it finds the "NULL" end of string marker. Serial.println(strlen(t));


0

Thanks @VE7JRO, it does the job :) const byte bufferSize = 16; char inputBuffer[bufferSize + 1]; int myDelay = 20; void setup(){ Serial.begin(9600); pinMode(13, OUTPUT); pinMode(12, OUTPUT); } void loop(){ if(Serial.available() > 0){ byte bytesRead = Serial.readBytesUntil('\n', inputBuffer, bufferSize); if(bytesRead == 16){ for(...


0

If you are able to send the message as 16 chars, followed by a newline, then here is a test sketch that might work for you. Use the Serial Monitor to send the 1000100100110101 data. Please ensure you have the Serial Monitor set to send a Newline Only. // Valid input data from serial is 16 chars followed by a newline. // 1000100100110101 const byte ...


Top 50 recent answers are included