One more caution- it appears the ADCAll method sets All possible pins to analog inputs. If you just want to get the counts from vref, it is on channel 17. Although the Micropython documentation says the argument for the ADC() method must be a pin, it apparently accepts a channel:
>>>
>>> a = pyb.ADC(17)
>>> a.read()
1459
>>>
This is correct for my supply voltage. So if you see pins change from, say, OUT_PP to ANALOG after the ADCAll method, this is why...
Can you get the supply voltage?
Re: Can you get the supply voltage?
thanks, I didn't realize you could directly access the special ADC channels. I edited my whining earlier in this thread.
Code: Select all
#define ADC_CHANNEL_TEMPSENSOR ((uint32_t)ADC_CHANNEL_16)
#define ADC_CHANNEL_VREFINT ((uint32_t)ADC_CHANNEL_17)
#define ADC_CHANNEL_VBAT ((uint32_t)ADC_CHANNEL_18)