I am getting an 'AttributeError: 'ADC' object has no attribute 'vref_to_pin()'' error when I try to use the ADC library in micropython on a lopy4
-
I am working with a lopy4 module for a contest I am entering. I use the machine.ADC library for getting data from an analog sensor.
I can use basic functions like ADC.init(), but as you know, before getting data from an ADC pin, you need to calibrate the voltage reference of the used pin.
As documented on the pycom docs, the process of calibration is based on the ADC.vref_to_pin() attribute. However, when I try to call ADC.vref_to_pin(), it returns an 'AttributeError: 'ADC' object has no attribute 'vref_to_pin'. The same happens when I try to use ADC.vref().
I must add that the machine library works fine, as I am using the machine.I2C library just fine.
Here is the basic code I am trying to run:
import pycom import machine adc = machine.ADC() voltage = adc.vref_to_pin('P22') print (voltage)
-
i think the function does not return any thing. it just connects the internal 1,1 V to a pin
so voltage does not become anything.
what software version are you running. if i run
adc.vref_to_pin('P22')
i get nothing
if i run
voltage = adc.vref_to_pin('P22') print (voltage)
i get None