Function | Definition |
---|---|
adc.read() | Read the ADC result at assigned pin |
Plaese refer: “GPIO Table” for detail.
Description
Read the ADC result at assigned pin.
Syntax
data= adc.read(pin)
Parameters
pin: gpio pin ID. There are 5 ADC ports supported in WiFiMCU: D1, D13, D15, D16, D17.
Returns
data: if succeed, data between 0~4095 is returned, else nil.
Note that: 0 presents 0V, 4095 presents 3.3V.
Examples
-=adc.read(1)
-1
-=adc.read(1)
-4095