Object or system for smooting out data going to serial out.
I’m trying to build a usb slider interface that can control the positions of several servo motors powered by an Arduino. My goal is to have each servo be controlled by its own slider, and that I can move multiple sliders at the same time to control multiple servos at the same time.
The problem is that the quicker I move one slider up and down (0-127-0) the data read by the serialRead (serial running 9800 baud) in Arduino eventually gets mucked up. It will read a clear scrolling signal from 0-127 and back if I move it slowly, but if I do it fast it will read combined points (12485) or nonsense data points (-15) in the Arduino reader. If I do two or more sliders at the same time, it’s even worse.
Is there and object, or a system of objects I can use to put the numbers from multiple sliders into that will slow down all the incoming messages and output them at a speed that reads properly over the serial port to the Arduino (9800 baud I guess)?
It doesn’t have to read the backlog of data: I don’t need ever slider tick to read perfectly. Rather I would like it to read the stream of data only often enough (at a rate) that it will be able to be send over the serial port without collecting the errors I describe.
Each slider has their its own range, and a "," as a separator, which are parsed to send to the different servos.
Regarding thinning out the data, wouldn’t something like this work?
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 607.3ocyWssiaBCD8YxWgkeNMBCITReqeGUUqLvjDuBroFytIc09uWeABjp. k1kf5Kg3gwdNmybA3sUd3DwYnBi9B5aHOu2V44YMYL30r1CWPOmlSqrtgSEE E.WgW6tmBNqr1qnEk4L9QzAI7iZfmdo0kCxiIFW7232XgWWv34fxdhjV2DbU E6mf0VPeeE0pVmasVRUomzQ6IIjpbvmP1o2DJvDl9KPeuYOrLKPEIO+IxNbu nxoE1nh+pjQywla79pUleV+AEkC4BpB8BHqXB9lMaVXIIbqSLbWhGWRBmWIg CupO16qH36Q5f+FRSFgz98IcX3njlzBE2YqtTBtSoAnW2zisNoRIj.RcBPZZ l.x0HMdJqUHAO+B50S.GkP4GgrqUP5VMHUTyU2HcKTm1MkUjcWE56Jw9ybck UfveX9ELL+1suaPhibCU+DOX4CyjkQXSVqqHpjJ07WAxm.NMIG5qyyi5nDGO pO2wTmI2HE32ICAiJCQiJCiS+4azh9nkBMFenSWbBQjq1HdLQY6fhxsEEySh uJmk8GZKlLGIDWi8dWR+y1KaGflgCRyEKwy3O1mnD2eb218ikzClVmv+s47n ojxIyPJ25n8oX+1aeZwlw9sDuRTKSaCSS6EpCcYPkhwoJ8qY0ymfa74DKKC3 8m4VvxJE5DSCDB1uYm90jrc0wW+eWLXUFljMb06Twd7DvtgejQv97glnIhF+ EAMAS.MgKFZHSrJ6eIS4ZAnkkMeefEJFfn6xeVHMKiVaWx3tk19WrDdg05en 0BUpamU5d4Zoajx43H8.Ecbde0u.cYCNy. -----------end_max5_patcher-----------
The first suggestion would be to run your serial connection significantly higher than 9800 baud. That speed is incredibly slow for multiple bytes of message data and creates a (probably) unnecessary bottleneck on it. Is there some specific reason to run it so low? I’d suggest trying 115200 baud and see if that alleviates the problem before trying anything more involved. If you want to run slower than that, successively try slower speeds until the problem reappears.
Forums > MaxMSP