Analog input
Summary
This exercise will teach you about the ADC used to bind the pin labelled A0, and the single function contained which is read only.
Requirements
- 1 x LOLIN D1 MINI PRO board
- 1 x Micro USB
- 1 x Breadboard
- 1 x Variable resistance source (Variable Resistor, Potentiometer, Photo-resistor)
- 1 x 1k ohm resistor
- 2 x cables
Building the circuit
The following diagram will help you build the circuit.
The 1k resistor is used to limit the voltage to 1V for the A0 pin.
Programming the board
The script to read the balue from the ADC is simple
1 2 3 4 5 6 7 8 9 10 11 |
|
This is the end of Tutorial 8 for LOLIN D1 Mini Pro, you should now be able to read analog inputs through the ADC. Unfortunately, the ADC does not allow to output, but it can be used for variable input control.