noppakows
Posts: 1
Joined: Tue Feb 10, 2015 7:13 pm

How to control sampling rate of ADC MCP3008 ?

Tue Feb 10, 2015 7:24 pm

From http://hertaville.com/2013/07/24/interf ... i-using-c/

I have problem about ADC MCP3008. How to control this sampling rate ?

-rst-
Posts: 1316
Joined: Thu Nov 01, 2012 12:12 pm
Location: Dublin, Ireland

Re: How to control sampling rate of ADC MCP3008 ?

Tue Feb 17, 2015 11:03 am

Maybe I am thinking too simple, but in the example code you link the command 'sleep(1);' waits for a second, so the sample rate would be 1/s (= 1 Hz). To change this look at replacing 'sleep' with 'usleep' or 'nanosleep'.
http://raspberrycompote.blogspot.com/ - Low-level graphics and 'Coding Gold Dust'

Return to “C/C++”