Maxim mbed development library
Dependents: MAX34417_demo MAXREFDES1265 MAXREFDES1265
Fork of mbed-dev by
AnalogOut Class Reference
[Drivers]
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. | |
void | write (float value) |
Set the output voltage, specified as a percentage (float) | |
void | write_u16 (unsigned short value) |
Set the output voltage, represented as an unsigned short in the range [0x0, 0xFFFF]. | |
float | read () |
Return the current output voltage setting, measured as a percentage (float) | |
AnalogOut & | operator= (float percent) |
An operator shorthand for write() | |
operator float () | |
An operator shorthand for read() |
Detailed Description
An analog output, used for setting the voltage on a pin.
Synchronization level: Thread safe
Example:
// Make a sawtooth output #include "mbed.h" AnalogOut tri(p18); int main() { while(1) { tri = tri + 0.01; wait_us(1); if(tri == 1) { tri = 0; } } }
Definition at line 52 of file AnalogOut.h.
Constructor & Destructor Documentation
AnalogOut | ( | PinName | pin ) |
Create an AnalogOut connected to the specified pin.
- Parameters:
-
AnalogOut pin to connect to (18)
Definition at line 60 of file AnalogOut.h.
Generated on Tue Jul 12 2022 20:41:24 by 1.7.2