I need to send gyroscope values and a voice command flag and counter with a start and end marker through serial in the format <2,4,5,6> through Arduino Software serial using the HC05 Bluetooth module between Arduino Micro boards. I can send values in the struct format. But it seems that the order of the struct gets changed after a few seconds of receiving on the other side. How can I send these values in the mentioned format? I am new to this. Please help me out. It would also help if I could get suggestions on how to receive and parse this data of this format in the correct order/way.
-
why do you use SoftwareSerial? Micro has Serial1 for RX/TX pinJuraj– Juraj ♦2020年08月26日 15:22:18 +00:00Commented Aug 26, 2020 at 15:22
-
@Juraj , I need to monitor the values since the transmission is so fast and needs the least latency possible. Besides, I could never get my bluetooth modules to work on hardware serial. Please provide me with a demo code or some link. Are there two hardware serial on Arduino Micro? I'm not sure. Please enlighten me.Nahian Rifaat– Nahian Rifaat2020年08月26日 15:32:59 +00:00Commented Aug 26, 2020 at 15:32
-
there is USB named Serial and UART named Serial1. pins RX/TX are Serial1Juraj– Juraj ♦2020年08月26日 15:36:26 +00:00Commented Aug 26, 2020 at 15:36
-
@Juraj , I have been trying wireless communication using Serial but not Serial1. Is that the reason I am unable to send? Also, the question still remains how I can send, receive and parse the data to be sent in the format <2,3,4,5>Nahian Rifaat– Nahian Rifaat2020年08月26日 15:47:23 +00:00Commented Aug 26, 2020 at 15:47
-
where are you sending the serial data?jsotola– jsotola2020年08月27日 00:14:04 +00:00Commented Aug 27, 2020 at 0:14
1 Answer 1
Try Google Protobuf it's really awsome. I use it every time when I connect C# app to STM but it can be used in this case as well. U use Protobuf to encode your message and COBS do remove zeros from message so you can slap it on the end to know when the packet ends
-
Google Protobuf does work on AVR Arduino?2020年08月27日 04:55:01 +00:00Commented Aug 27, 2020 at 4:55
Explore related questions
See similar questions with these tags.