https://github.com/patrickbaus/ad568xr
An Arduino compatible library for the AD568xR family of nanoDACs
https://github.com/patrickbaus/ad568xr
arduino arduino-library dac
Last synced: 3 months ago
JSON representation
An Arduino compatible library for the AD568xR family of nanoDACs
- Host: GitHub
- URL: https://github.com/patrickbaus/ad568xr
- Owner: PatrickBaus
- License: gpl-3.0
- Created: 2018-08-14T22:17:05.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-03-26T13:50:08.000Z (almost 2 years ago)
- Last Synced: 2024-03-26T14:53:06.224Z (almost 2 years ago)
- Topics: arduino, arduino-library, dac
- Language: C++
- Size: 41 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
AD5681R/AD5682R/AD5683R Arduino Library
===================
This repository contains an Arduino library for the Analog Devices AD5681R/AD5682R/AD5683R family of nanoDAC+s written in C++. The library uses SPI Transactions and allows to select the SPI controller if there is more than one.
Usage
-----
```cpp
#include
#include "ad568xr.h"
#define CS_PIN 10
#define SCK_PIN 14
AD5681R dac(CS_PIN, SPI); // To use the 14-bit version use AD5682R, or AD5683R for the 16-bit brethren
void setup() {
pinMode(SCK_PIN,OUTPUT);
SPI.setSCK(SCK_PIN);
SPI.begin(); // Not needed if you pass `true` to dac.begin()
dac.begin(); // Call dac.begin(true) if you want to automatically run SPI.begin()
dac.reset(); // Reset the internal DAC registers
dac.setGain(true); // Set the maximum output voltage to 2*Vref = 5 V
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
}
void loop() {
static uint16_t outputValue = 0;
dac.setValue(outputValue++); // Increment the DAC output every 10 ms
delay(10);
}
```
Installation
-----
Currently the library does not support the Arduino library manager, so it is highly recommended to copy the full library to a subfolder called
```
src/
```
within your Arduino project.