serial i/o

I need to take a serial data string of approximately 18 bytes and parse the string to extract two bytes in a known position which represent the output of a 10bit ADC sample of a sensor, then convert the binary value to a sensor parameter for display on the screen of the kinoma. I may date stamp the sample as well.
Is there any existing code anyone knows of that does some of the described task? Thanks, JM

Answers

  • I need to take a serial data string of approximately 18 bytes and parse the string to extract two bytes in a known position which represent the output of a 10bit ADC sample of a sensor, then convert the binary value to a sensor parameter for display on the screen of the kinoma. I may date stamp the sample as well. Is there any existing code anyone knows of that does some of the described task? Thanks, JM

  • Answer ✓

    Hi JM,

    We have a sample that does some serial data handling that I think is similar to what you're asking for. For the sake of this post, I'm assuming your data is a Hex string. Our Serial GPS Sensor Demo deals with data coming in as a comma separated string (see device/MTK3339.js line 72/73). Instead of splitting the incoming data string, you could use substring to locate your fixed-position data. This file also contains examples for how to transform data for presentation back to the main app.

    Switching gears, the Analog Proximity Sensor Demo is a great example of how to display frequently updated sensor data on the screen. The sensor type is different, but the UI setup is pretty universal.

    I think those two samples are a great place to start the project you're describing. If you run into any issues, or have any further questions, please let me know.

    Cheers,

    Will

  • Thanks Will, I'll give that a try

Sign In or Register to comment.