Added DDS sample. Fixed pin 11 PWM output, now default (3 works better).

This commit is contained in:
Stephen Olesen
2015-07-01 17:56:40 -06:00
parent 016ad2398a
commit 120442533d
3 changed files with 89 additions and 11 deletions

32
examples/DDS/DDS.ino Normal file
View File

@@ -0,0 +1,32 @@
#include <HamShield.h>
#include <Wire.h>
DDS dds;
void setup() {
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(11, OUTPUT);
dds.start();
dds.setFrequency(440);
dds.on();
delay(5000);
}
void loop() {
dds.setFrequency(2200);
delay(5000);
dds.setFrequency(1200);
delay(5000);
}
#ifdef DDS_USE_ONLY_TIMER2
ISR(TIMER2_OVF_vect) {
dds.clockTick();
}
#else // Use the ADC timer instead
ISR(ADC_vect) {
TIFR1 = _BV(ICF1); // Clear the timer flag
dds.clockTick();
}
#endif