Output to Floats, Serial Comm Arduino Help
Hello!
I am pretty new to Max and I'm using the serial object in max to get input from my Arduino.
It works great however, I seem to not be able to output it to a float which I require.
I think the problem must be something I'm missing in the formatting but I can't seem to find what it is.
As you can see on my console the numbers output fine with their respective floats, but I can't get this on the actual patch. I'm using flonums and I also tried using the float object but it hasn't made a difference.
Many Thanks for any help ! !
Jo
Hi
you are using [unpack] in integer mode; to unpack floats use [unpack f f ]. Although, floats are CPU intensive as far as Arduino goes, and I have no idea how the serial bus handles floats. I never send floats over the serial port. Why not send ints (either Serial.print or Serial.write) from Arduino and then normalize in Max, for example (0 ~ 255) * 0.00389 = 0.0 ~ c1.0. That's 8-bit precision with Serial.write; with Serial.print, you could go as precise as you want (within limits)
HTH
Brendan
I am using a Barometric Pressure sensor, and I was just utilizing the basic sketch that came with it to test it out and it reads things like temp and pressure, so its set to output to floats.
I didn't know this was CPU intensive for the Arduino however, and had no idea about arduivis,
Thanks so much Brendan!