vsergeev / c-periphery

A C library for peripheral I/O (GPIO, LED, PWM, SPI, I2C, MMIO, Serial) in Linux.
MIT License
740 stars 229 forks source link

ADC - implemented? #44

Open habakuk1979 opened 2 years ago

habakuk1979 commented 2 years ago

Hello!

have you implemented the ADC (analog inputs) in your code too?

pezi commented 2 years ago

The Raspberry Pi and most clones computer do not have a way to read analog inputs. This functionaly is provided by additonal hats or projects like this one: https://learn.adafruit.com/reading-a-analog-in-and-controlling-audio-volume-with-the-raspberry-pi?view=all

sgjava commented 2 years ago

For a LDR you can just use a capacitor https://www.instructables.com/Raspberry-Pi-GPIO-Circuits-Using-an-LDR-Analogue-S and digital pins.

vsergeev commented 1 year ago

This might be implemented in the future through the IIO sysfs interface. Similar request has been made in vsergeev/python-periphery#19.