Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: blinky_max32630fthr
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 14:21:38 by
1.7.2
