I'm trying to send data from a processing sketch to my Arduino Uno, using serial, in order to control the speeds of two motors, that need to run at separate speeds. I'm using the controlP5 library for processing with two sliders ranging from 0 to 255. What I would like to achieve is for my computer to send data prefixed by 'L' or 'R' to indicate the motor and the value of the speed desired, e.g 'L127'.
I have been looking for a while and I can't figure how to do this. I'm not fully sure of the difference between strings and bytes or which would be better for my task?
If you could point me in the direction of two things that would be great:
- How to send this data from processing?
- How to interpret this data on the arduino, so basically decide which motor to affect by the 'L' or 'R' and then apply the value.
Thanks in advance,