Hi All,
I'm reading data coming from an HM-10 Bluetooth LE module via software serial. Everything works OK, and a typical scan data result (i.e. message coming in from the HM-10 over the software serial) would be:
OK+DISISOK+DISC:4C000215:FDA50693A4E24FB1AFCFC6EB07647825:0005000664:E6F4357FEB3E:-091OK+DISC:4C000215:FDA50693A4E24FB1AFCFC6EB07647825:2714D4D0C0:A0E6F869A527:-082OK+DISC:00000000:00000000000000000000000000000000:0000000000:7A2BC9341733:-081OK+DISC:4C000215:00001803494C4F474943544543480000:0001000200:A0E6F8474ED0:-095OK+DISCE
One long string of data with no line breaks or nothin'. You will need to scroll the above window to the right to see it all.
The sketch is very basic, but for the record, here it is:
#include <SoftwareSerial.h>
SoftwareSerial HM10(2, 3); //HM10(Receive Pin, Transmit Pin)
void setup()
{
Serial.begin(57600); // Begin the Serial Monitor connection at 57600bps
HM10.begin(57600); // Begin the HM-10 connection at 57600bps
}
void loop()
{
if (HM10.available()) // Read from HM-10 and send to Serial Monitor
Serial.write(HM10.read());
if (Serial.available()) // Read from Serial Monitor and send to HM-10
HM10.write(Serial.read());
}
Now here's the weird part: When I cut and pasted this data from the serial monitor window into TextEdit on my iMac, it suddenly looked like this:
OK+DISISOK+DISC:4C000215:FDA50693A4E24FB1AFCFC6EB07647825:0005000664:E6F4357FEB3E:-091OK+DISC:
4C000215:FDA50693A4E24FB1AFCFC6EB07647825:2714D4D0C0:A0E6F869A527:-082OK+DISC:
00000000:00000000000000000000000000000000:0000000000:7A2BC9341733:-081OK+DISC:
4C000215:00001803494C4F474943544543480000:0001000200:A0E6F8474ED0:-095OK+DISCE
Nothing special about the first "DISC:", but every subsequent "DISC:" appears to have a hidden "new line" or maybe "carriage return" or something after it. It's not visible, but you can know it's there by the appearance in the TextEdit window. So my question is: What is this mysterious hidden character? I would really like to know since I want to use it as the terminating character when reading data into a char.
I took the same text and pasted it into BBEdit (with Show Invisibles turned on) to see if the hidden character would show up there, but nothing.
Any ideas what it might be or how I can figure it out?
Thanks!
Update:
Just realized that there is a hidden mystery character after the first DISC: also. If I narrow the window of TextEdit, the text suddenly looks like this:
OK+DISISOK+DISC:
4C000215:FDA50693A4E24FB1AFCFC6EB07647825:0005000664:E6F4357FEB3E:-091OK+DISC:
4C000215:FDA50693A4E24FB1AFCFC6EB07647825:2714D4D0C0:A0E6F869A527:-082OK+DISC:
00000000:00000000000000000000000000000000:0000000000:7A2BC9341733:-081OK+DISC:
4C000215:00001803494C4F474943544543480000:0001000200:A0E6F8474ED0:-095OK+DISCE