An analog output, used for setting the voltage on a pin. More...
#include <AnalogOut.h>
Public Member Functions | |
AnalogOut (PinName pin) | |
Create an AnalogOut connected to the specified pin. More... | |
void | write (float value) |
Set the output voltage, specified as a percentage (float) More... | |
void | write_u16 (unsigned short value) |
Set the output voltage, represented as an unsigned short in the range [0x0, 0xFFFF]. More... | |
float | read () |
Return the current output voltage setting, measured as a percentage (float) More... | |
AnalogOut & | operator= (float percent) |
An operator shorthand for write() More... | |
AnalogOut & | operator= (AnalogOut &rhs) |
An operator shorthand for write() More... | |
operator float () | |
An operator shorthand for read() More... | |
An analog output, used for setting the voltage on a pin.
Example:
Definition at line 53 of file AnalogOut.h.
AnalogOut | ( | PinName | pin | ) |
Create an AnalogOut connected to the specified pin.
pin | AnalogOut pin to connect to |
Definition at line 61 of file AnalogOut.h.
operator float | ( | ) |
An operator shorthand for read()
Definition at line 133 of file AnalogOut.h.
AnalogOut& operator= | ( | float | percent | ) |
An operator shorthand for write()
Definition at line 113 of file AnalogOut.h.
An operator shorthand for write()
Definition at line 123 of file AnalogOut.h.
float read | ( | ) |
Return the current output voltage setting, measured as a percentage (float)
Definition at line 102 of file AnalogOut.h.
void write | ( | float | value | ) |
Set the output voltage, specified as a percentage (float)
value | A floating-point value representing the output voltage, specified as a percentage. The value should lie between 0.0f (representing 0v / 0%) and 1.0f (representing 3.3v / 100%). Values outside this range will be saturated to 0.0f or 1.0f. |
Definition at line 73 of file AnalogOut.h.
void write_u16 | ( | unsigned short | value | ) |
Set the output voltage, represented as an unsigned short in the range [0x0, 0xFFFF].
value | 16-bit unsigned short representing the output voltage, normalized to a 16-bit value (0x0000 = 0v, 0xFFFF = 3.3v) |
Definition at line 85 of file AnalogOut.h.