Message Boards Message Boards

Dynamic List Plot of Serial Input in Mathematica via Arduino Serial.Print()

Posted 6 years ago

Hey everybody, I'm trying to read the serial input of my USB Port into Mathematica dynamically to create a live ListPlot. My Arduino Uno sends strings in the format of a pair via Serial.print() to the Serial Port:

][1]

(the constant Output "{0,1}\n" is just a test value)

In Mathematica 11 I connect to the Serial Port via DeviceOpen[] and start a Task that reads out the Buffer Data on my Arduino and converts it to a string. Then I split that string into substrings at any "\n" to get pairs and interpret them in Wolfram Language as a pair. I add these pairs to a list and then Plot that list dynamically via ListLinePlot[].

][2]

My Problem is that Mathematica doesn't read that data correctly and mostly mashes up the data and crashes.

It would be great if you guys could help me out with that!

Thanks!

Attachments:
POSTED BY: Franz Biermann
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract