ASCII serial string formatting and conversion

T_Mak's icon

I'm generally confused about taking data (ASCII) I'm getting serially from a sensor, getting rid of data delimiters and checksums and converting what I've kept to usuable decimal (float) numbers.

An example of sensor output could be $C144.43*7E. Where the $C and the * are the delimiters and 7E is the checksum. What I really need is 144.43. The data can range from 0.00 to 359.99, so I'm working with numbers that don't always have the same number of places.

Where I'm getting hung up is that the output from the serial object is, as one would suspect, serial i.e., I get one integer representing each ASCII symbol. What i need to do is get rid of the nonsense and convert and package the relevant data to individual floats with two decimal places, in this case 144.43.

I've been mucking about with the sprintf object as well as regexp. The regexp object, with the correct attributes seems to work when I feed it ASCII from a message box, successfully stripping out everything but the necessary characters.

Any help or musings would be great appreciated.

Thanks

José Manuel Berenguer's icon
T_Mak's icon

Thanks I'll give it a shot and let you know how it goes.
Best- Todd

T_Mak's icon

Thanks so much!!! I twiddled around a bit and found my solution!

Max Patch
Copy patch and select New From Clipboard in Max.