Support Forum

Share your projects and post your questions

Register   or   Sign In
The Forum

Question on the read_voltage() function

The ADC Pi is an Analogue to Digital converter for the Raspberry Pi

25/07/2018

Posted by:
WayneA

WayneA Avatar

Does anyone have any example C code using the 'read_voltage() function'



We want to use the ADC Pi to read a varying voltage, send it out as a serial 16/17 bit number and then store it

in the R-Pi's memory as a parallel number.

Any examples of C code to do this would be greatly appreciated.

Regards,

Wayne

25/07/2018

Posted by:
andrew

andrew Avatar

Hello Wayne

You can find a demo application using the read_voltage() function in our GitHub repository at demo-adcread.c

read_voltage() takes 5 parameters:

address - I2C address for the target device e.g. 0x68
channel - 1 to 4
bitrate - 12, 14, 16 or 18
pga - 1, 2, 4 or 8
conversionmode - 0 = one-shot conversion, 1 = continuous conversion

The function returns a double-typed voltage from the ADC.

Sign in to post your reply


Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view.
Download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.

Home

Shop

Learn

Forum

FAQ

Contact

0 item

Your cart is empty

Please browse our shop to order from the wide range of Raspberry Pi boards and accessories.

Subtotal:£0.00
View Basket Continue to Checkout