If your Microcontroller does not provide a dedicated analog output you can use the serial output instead as a poor man's work around. The idea is based on the fact that the output of 0b0 leads to 0 Volt on the signal line and the output of 0b1111111111111111 leads to 3.3V.
More...
#include <SerialDAC.h>
|
| SerialDAC (Stream &out, uint minSampleValue=0, uint maxSampleValue=65535) |
| Constructor.
|
|
uint | baudRate (uint samplingRate) const |
| convert the sample rate to the necessary baud rate (bit per second (bit/s)) - please set the baud rate of your serial interface to the calculated value
|
|
void | write (uint16_t *inValues, int len) const |
| writes a buffer to the tx line
|
|
void | write (uint16_t value) const |
| writes a single value to the tx line
|
|
|
void | convert (uint16_t *inValues, uint16_t *outValues, int len) const |
|
uint16_t | convertValue (uint16_t value) const |
|
uint | map (uint x, uint in_min, uint in_max, uint out_min, uint out_max) const |
|
|
long | maxSampleValue |
|
long | minSampleValue |
|
Stream * | out_ptr |
|
const uint16_t | values [17] |
|
If your Microcontroller does not provide a dedicated analog output you can use the serial output instead as a poor man's work around. The idea is based on the fact that the output of 0b0 leads to 0 Volt on the signal line and the output of 0b1111111111111111 leads to 3.3V.
- Author
- Phil Schatzmann
- Copyright
- GPLv3
◆ values
const uint16_t SerialDAC::values[17] |
|
protected |
Initial value:= {
0b0000000000000000,
0b0000000000000001,
0b0000000000000011,
0b0000000000000111,
0b0000000000001111,
0b0000000000011111,
0b0000000000111111,
0b0000000001111111,
0b0000000011111111,
0b0000000111111111,
0b0000001111111111,
0b0000011111111111,
0b0000111111111111,
0b0001111111111111,
0b0011111111111111,
0b0111111111111111,
0b1111111111111111
}
The documentation for this class was generated from the following file: