1

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.

6
  • why do you use SoftwareSerial? Micro has Serial1 for RX/TX pin – Juraj Aug 26 '20 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 Aug 26 '20 at 15:32
  • there is USB named Serial and UART named Serial1. pins RX/TX are Serial1 – Juraj Aug 26 '20 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 Aug 26 '20 at 15:47
  • where are you sending the serial data? – jsotola Aug 27 '20 at 0:14
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

1
  • Google Protobuf does work on AVR Arduino? – Juraj Aug 27 '20 at 4:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.