How to plot a live graph using bluetooth data from ucontroller

rajughade2006

Member
Licensed User
Longtime User
Hello,
I am trying to develop my first official android application and have undertaken a project for the same. Ive have had fun so far learning b4a nuances.(forgive me if i am being an idiot as regards b4a :sign0144:)

First let me explain my hardware part:
This consists of a ucontroller testing module that will send voltage and current values successively (i believe in ASCII format) with a word tag at the end like so- 'number'V 'number'I (next iteration) 'number'V 'number'I (next iteration) and so on...
The ucontroller i am using is pic18f46xx
This will happen only when i press a button on my app which will send a signal to ucontroller to begin that particular subroutine and send data only after that.

What ive done and know so far:
I have been able to study existing programs and using tutorials like Asyncstream and bluetooth chat i am able to receive the data on my phone and see it on the phone in the format i mentioned above. I also understand how to plot a graph using 'plot' and 'canvas' as well as i have help from existing tutorials.

Heres what i havent been able to do:
My basic aim is to plot these values on a graph, it can be live or passive(meaning data is stored first and then plotted or otherwise).
The beef being that i have no idea how to use the data coming from bluetooth or store it by separating the word tags 'v' or 'c' (in an array or such) and then use it to plot my graph. I have read all related tutorials for inspiration as well as other creations but to no avail.

:sign0163:
I request urgent help regarding this and appreciate any and all inputs i can get.
:sign0085:

Thanks and regards,
Raj.
 

klaus

Expert
Licensed User
Longtime User
Attached you find a modified version of the Y_X class.
Up to you adapt it to your needs.
 

Attachments

  • Y_T_Plot.zip
    9.5 KB · Views: 507
  • Y_T_Plot.jpg
    Y_T_Plot.jpg
    27.5 KB · Views: 409
Upvote 0

ferdztech

Member
Licensed User
Longtime User
Do you have file with example data ?
What is the sampling frequency ?

Sample Data 1.txt and 2.txt ' actually its a pulse
Frequency: 20mhz

How to plot my sample data one by one without storing on array records? just plot it every single data in X Y
I need also a reset/clear method for graph in your class plot.


Thank Your Sir Klaus.
 

Attachments

  • 1.txt
    106.1 KB · Views: 267
  • 2.txt
    106.2 KB · Views: 226
Upvote 0

ferdztech

Member
Licensed User
Longtime User
Sample Data 1.txt and 2.txt ' actually its a pulse
Frequency: 20mhz

How to plot my sample data one by one without storing on array records? just plot it every single data in X Y
I need also a reset/clear method for graph in your class plot.


Thank Your Sir Klaus.

Thank you sir my Problem is solved. I had test your Y_T_Plot.zip revision it finally adapt to my works. Clear/Reset Also added and a new draw point. For direct plot.Thanks a lot. Keep up the good works and more power. god bless again.
 
Upvote 0
Top