Serial data stream

Apologies being so new but stuggling to get a grip on a few things - I have some x y and z data coming in from a serial device on OS X - I can verify that this works ok from using Zterm and seeing data flowing in.

Initially all I need is for that data to be shown onscreen - I’v altered the serial port details and baud rate in the Serial Example and when I click the mouse the data onscreen varies and the led on my device flashes to show that communication is occuring.

I just need some pointers to alter the example to just show live data readout without having to click a mouse…

Stage 2 will be to use x y z data in a graphical fashion but thats not for today.

Can anyone easily tell me how alter the code to suit?

Many thanks

Yes… you should be able to do it quite easily as this:

  1. In your setup() method, change
  
bSendSerialMessage = false;  

to

  
bSendSerialMessage = true;  

  1. in the update() method, near the bottom, comment (or delete) the line
  
bSendSerialMessage = false;  

  1. you could also comment/delete the line from your mousePressed() method (so mousePressed() would be empty if you’re just using the code from serialExample)
  
bSendSerialMessage = true;  

Many thanks for that - now you’ve got me thinking…

My data coming in the serial contains various hex data - including x and y coordinates and z pressure - plus a constant address, stop bit and another string to show a release of touch…

Can I extract the bits I need and convert that into pointing commands do you think for cursor control etc?

Many thanks