Not Getting Output in STM32 401RE 12-Bit ADC

That’s because the parameter analogReadResolution(ADC_BITS) is meant for the Arduino Due,
which does not use the STM32.

From the emonlib readme.txt file:

Update: 5th January 2014: Support Added for Arduino Due (ARM Cortex-M3, 12-bit ADC) by icboredman.

To enable this feature on Arduino Due, add the following statement to setup() function in main sketch: analogReadResolution(ADC_BITS); This will set ADC_BITS to 12 (Arduino Due), EmonLib will otherwise default to 10 analogReadResolution(ADC_BITS);.
See blog post on using Arduino Due as energy monitor:
Home Energy Monitoring System

This thread may be of some help:

1 Like