Android Question Plot points and slide them to the left

Pablo Torres

Active Member
Licensed User
Hi, I have a Tablet connected to an arduino that is sending to the tablet data (one value) 50 times per second. I have to show that data in the tablet, and it has to look like the red part in the image below.
Now, the question is, how can I “add” new point to the left, erase first point of the right and slide all the points exactly 1 point to the left... and refresh it 50 times per second?

I will appreciate any help
Thank you all very much
 

Attachments

Brian Dean

Active Member
Licensed User
... and slide all the points exactly 1 point to the left...
Are you sure that is what you really want to do? Because I don't think that you will see anything except a band of noise. It will not look like the waveform that you show in your attachment. Real oscilloscipes (both analogue and digital) draw the waveform from left to right, then erase the screen and draw a new trace. Are are you trying something new? Surely you need to set a trigger value, just as in a real oscilloscope, to provide a repetitive reference point, and then add points from left to right.
 

Brian Dean

Active Member
Licensed User
... then erase the screen and draw a new trace.
Forget about that bit for a digital 'scope. Keep a list of the point values on each traverse. Then, on the next sweep, remove the previously plotted points , replacing them one-by-one with the new (although prabably the same) value.
 

klaus

Expert
Licensed User
You could use the xChart b4xlib library with a Line chart.
Attached a small B4A project showing the possibility.
You need to add the xChart.b4xlib to the \AdditionalLibraries\B4X folder and chsck it in the Libraries Manager Tab in the IDE.
 

Attachments

Top