EasyManua.ls Logo

AZ-Delivery D1 Mini - Analog Input Pin

AZ-Delivery D1 Mini
27 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
- 11 -
To enable PWM on a certain pin, use the following line of code:
analogWrite(pin, value)
where pin is the name of GPIO pin, and value a number between 0 and 1023.
The range of the PWM output can be changed by using the following line of
code: analogWriteRange(new_range)
The frequency of PWM can be changed by using the following line of code:
analogWriteFreq(new_frequency)
where new_frequency should be between 100Hz and 1000Hz.
Analog input pin
Just like on any Arduino board, function analogRead(A0) can be used to get the
analog voltage on the analog input (0 = 0V, 1023 = 1.0V).
The D1 Mini module can also use the ADC to measure the supply voltage
(VCC). To do this, include ADC_MODE(ADC_VCC) at the top of your sketch, and
use ESP.getVcc() to actually get the voltage.
NOTE: If an analog input pin is used to read the supply voltage, anything
else can not be connected to the analog input pin!