I'm trying to build a lens encoder to feed serial data into Unreal Engine. I decided to use a Bourns absolute rotary encoder. However my serial data seems incorrect in the serial monitor.
Can anyone please offer some advice? I'm a novice when it comes to variable types and byte arrays, etc. I'm just simply looking to verify that my sketch is good, before I begin attempting to see the data in Unreal Engine
See my code attached, and also the readings from the serial Monitor:
@ieee48 as seen in the sketch, I'm attempting to send an integer via serial. The raw integer values coming from my encoder module are 'mpos', so I'm attempting to debug whether I'm properly sending the integer out as a byte. However, the serial monitor appears that the data I'm sending is not an integer - which is bad, not good. I'm not certain. Perhaps I am debugging the 'bytes' in the serial monitor incorrectly, or perhaps I'm handling the variables incorrectly.
I would suggest that you lean how to post code with code tags which is what SteveMann suggested earlier if you want someone to easily look at your code.
The Serial.write of the buffer will not show correctly in the monitor, but you can see that the data is correct from this example code
This is very helpful, thank you. Also thanks for the sample code which greatly help me resolve my uncertainty. Just watching serial monitor made me doubt the code. Intentions were to send to UE, but serial.write would still show up in the monitor, so I thought to focus on the discrepancy there. Moving forward I won't rely on serial monitor for the serial.write buffer. I'll be moving onto UE to debug the data now. I'm thankful to people like you who are contributing useful insights to this community.
I would suggest that you lean how to post code with code tags which is what SteveMann suggested earlier if you want someone to easily look at your code.
@ieee488 Not sure what you mean. I may need to 'lean'????