|
|
On 20 Oct 2020, at 10:56, LosCelos wrote:
>
> Hi,
>
> is there a way to read signals from an ADC on Raspberry Pi with FLTK ?
> I already have installed FLTK on Raspberry Pi and make some Apps and it works.
> But now i need to read data for example from a potentiometer which goes on a ADC MCP3008 and show the data on my FLTK on a scope like a oszilloskop.
>
> I have the Oszilloskop-App to show the data.
> And i can read the data from the ADC on my Raspberry Pi with a make-file (without FLTK).
>
> The problem is that i have to read it with fltk to show it with the app.
> Every data input should be shown instead, so there is no way to first put the data in a txt-file.
It’ll depend very much on what API your ADC presents (and how complicated you want to make things too, I suppose...)
Assuming your ADC presents some sort of C-callable API that acts as a FIFO or presents a buffer of data, say, then what I’d probably do myself is start the app in fltk, and create the UI, then spawn a worker thread to poll the ADC for input.
The worker then puts that data into a buffer, retaining on the last (however many you want to display) samples and the fltk main thread then reads that buffer periodically to refresh the display.
So, if you are comfortable with threads and such, that should be pretty straightforward. I you are not comfortable with threads... then this might be too complex a solution (sorry!)
--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/24AC03F1-2172-4D04-94D4-91D82940CDF1%40gmail.com.
[ Direct Link to Message ] | |
|
| |