An analog input, used for reading the voltage on a pin. More...
#include <AnalogIn.h>
Public Member Functions | |
AnalogIn (PinName pin) | |
Create an AnalogIn, connected to the specified pin. More... | |
float | read () |
Read the input voltage, represented as a float in the range [0.0, 1.0]. More... | |
unsigned short | read_u16 () |
Read the input voltage, represented as an unsigned short in the range [0x0, 0xFFFF]. More... | |
operator float () | |
An operator shorthand for read() More... | |
An analog input, used for reading the voltage on a pin.
Example:
Definition at line 53 of file AnalogIn.h.
AnalogIn | ( | PinName | pin | ) |
Create an AnalogIn, connected to the specified pin.
pin | AnalogIn pin to connect to |
Definition at line 61 of file AnalogIn.h.
operator float | ( | ) |
An operator shorthand for read()
The float() operator can be used as a shorthand for read() to simplify common code sequences
Example:
Definition at line 106 of file AnalogIn.h.
float read | ( | ) |
Read the input voltage, represented as a float in the range [0.0, 1.0].
Definition at line 72 of file AnalogIn.h.
unsigned short read_u16 | ( | ) |
Read the input voltage, represented as an unsigned short in the range [0x0, 0xFFFF].
Definition at line 85 of file AnalogIn.h.