-
Notifications
You must be signed in to change notification settings - Fork 39
Analog Input (ADC) #92
Comments
I'll try implementing this unless someone else is already doing it |
AFAIK nobody is on it. |
Sorry to dredge up this question, but I'm extremely new to all of this (including embedded development generally). Does this mean there's on way to read floating point numbers on, for example, PA0? I'm trying to read a piezo sensor input to recreate something like this: https://www.arduino.cc/en/tutorial/knock If it's not possible using this library, is it possible using any library for the blue pill? Thanks so much! edit: My apologies, I see this is currently underway in #114. I'm actually finding success using this PR for now. I suspect it will be merged soon because it seems to be working flawlessly for me, but I am not doing anything remotely complicated. |
The result of the ADC conversion is an integer from 0 to 4095, which corresponds to the input voltage from 0 to ~3.3 V. You can convert this value to the value you need, using constants from the datasheet of your sensor. |
The
stm32f103xx
chips have built-in analog-to-digital converters which aren't supported ATM bystm32f103xx-hal
. I'd be nice if there was support because they're often useful.I did some digging and this is how I gather it works:
adc_read
function (blocks thread until value has been read)The text was updated successfully, but these errors were encountered: