Keep getting zeros appearing in my serial data stream between two arduinos

This one is confusing me quite a bit. I have tested this code before building it up and it worked very well, but I seem now to be getting some issues and I'm not sure why.

I have two Teensy 3.2s; one of them is reading a pulsed signal and converting that into a speed which it then uses to drive a stepper motor. At the same time it also transmits the data across to another Teensy which should receive the speed data and display it on a small OLED display.

Rigging it up, it does work, but in my incoming data stream, SPEED_MPH shows the correct speed some of the time, with lots of zeros in between causing the screen to not work properly.

Can anyone help me understand where these zeros are coming from?

The TX code is "StepperDuino"
RX code is "DashCAN"

DashCAN.ino (39 KB)

StepperDuino.ino (8.71 KB)

Not sure if it's the only problem but it seems that I'm getting misreads on the RX Arduino as only sometimes am I getting a complete message. Others I'm getting just a single letter or fragment. How do I sort that out?

Solved it! I was initiating messages with ">" and not sending anything which was causing issues. Moved the "<" and ">" packet wrappers inside condition to send and all works nicely! As you were :slight_smile: