Methods
Read the analog value
This function allows you to read the ADC value.
apin.read()
Note apin.read() returns a raw ADC sample. Use the following equation to convert this value to mV:
sample mV = (A/D reading * Vref mV) / 4095
Read the analog value as a 16-bit number
This function allows you to read the ADC value and get the result as a 16-bit number—0 to 65535. This function is provided for compatibility with other MicroPython implementations.
XBee devices only support 12-bit ADC readings. Readings from read_u16() will match those from read(), scaled to a 16-bit range.
apin.read_u16()
Note apin.read_u16() returns a raw ADC sample. Use the following equation to convert this value to mV:
sample mV = (A/D reading * Vref mV) / 65535
Note This function is available on XBee Cellular and XBee 3 Cellular products with firmware ending in *16 or newer, and XBee 3 DigiMesh, 802.15.4 and Zigbee devices with firmware ending in *0B or newer.