Home › Forums › Mayfly Data Logger › Water level monitor with a Mayfly. › Reply To: Water level monitor with a Mayfly.
2016-07-25 at 12:05 PM #1677
Pardon the somewhat off-topic response, but regarding reading serial data I have found this post extremely helpful. Both of the examples above hold the loop() hostage until the whole string comes in. That’s okay in a small, single-sensor sketch, but it is susceptible to (a) truncating the string if the arduino gets ahead of the incoming data and (b) getting hung in the serial.read() “while” loop. It’s more robust (although, admittedly, more complicated) to add a single byte per loop() iteration.