i have a BGM113 bluetooth module that sends messages as binary form. I have to work on each bit separately. i am not sure about Serial.read()
gets it as binary but when i am trying to see at on the serial port screen with Serial.println(Serial.read(), BIN)
it shows me as string something like []...[]
What should i do ?
-
A byte is 8 bits. You can use "bit manipulation" to extract or set single bits. A very good tutorial here: (avrfreaks.net/forum/…)aaa– aaa01/19/2017 11:33:05Commented Jan 19, 2017 at 11:33
-
1There is a difference between binary form and base 2 (BIN) number conversion.Mikael Patel– Mikael Patel01/19/2017 12:09:34Commented Jan 19, 2017 at 12:09
-
Serial.read() reads a byte (8 bits) so you should receive 8 bits at a time. If there is some form of flow control then you might just get 1 bit. It looks like you are not getting any bits so check your code is waiting until data is available.Code Gorilla– Code Gorilla01/19/2017 13:03:29Commented Jan 19, 2017 at 13:03
Add a comment
|