mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
49 lines
846 B
Arduino
49 lines
846 B
Arduino
|
//
|
||
|
// FILE: demo_powerdown.ino
|
||
|
// AUTHOR: Rob Tillaart
|
||
|
// PURPOSE: demo DAC8550 library Arduino
|
||
|
// VERSION: 0.1.0
|
||
|
// URL: https://github.com/RobTillaart/DAC8550
|
||
|
|
||
|
|
||
|
#include "DAC8550.h"
|
||
|
|
||
|
|
||
|
DAC8550 myDAC(7);
|
||
|
|
||
|
|
||
|
void setup()
|
||
|
{
|
||
|
Serial.begin(115200);
|
||
|
Serial.println(__FILE__);
|
||
|
myDAC.begin();
|
||
|
|
||
|
myDAC.setValue(0);
|
||
|
myDAC.setPowerDown(DAC8550_POWERDOWN_HIGH_IMP);
|
||
|
}
|
||
|
|
||
|
|
||
|
void loop()
|
||
|
{
|
||
|
Serial.println("Start sawtooth");
|
||
|
for (uint16_t i = 0; i < 32000; i+= 100)
|
||
|
{
|
||
|
myDAC.setValue(i);
|
||
|
}
|
||
|
|
||
|
Serial.println("Stop DAC for 5 seconds");
|
||
|
myDAC.setPowerDown(DAC8550_POWERDOWN_HIGH_IMP);
|
||
|
uint32_t start = millis();
|
||
|
while (millis() - start < 5000);
|
||
|
myDAC.setPowerDown(DAC8550_POWERDOWN_NORMAL);
|
||
|
|
||
|
Serial.println("Continue sawtooth");
|
||
|
for (uint16_t i = 32000; i < 64000; i+= 100)
|
||
|
{
|
||
|
myDAC.setValue(i);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
// END OF FILE
|