2015-07-04 08:17:03 +00:00
|
|
|
#define DDS_REFCLK_DEFAULT 9600
|
2015-07-01 23:56:40 +00:00
|
|
|
#include <HamShield.h>
|
|
|
|
|
2015-11-23 16:54:10 +00:00
|
|
|
|
|
|
|
#define PWM_PIN 3
|
|
|
|
#define RESET_PIN A3
|
|
|
|
#define SWITCH_PIN 2
|
|
|
|
|
2015-07-04 08:17:03 +00:00
|
|
|
HamShield radio;
|
2015-07-01 23:56:40 +00:00
|
|
|
DDS dds;
|
|
|
|
|
|
|
|
void setup() {
|
2015-11-23 16:54:10 +00:00
|
|
|
// NOTE: if not using PWM out, it should be held low to avoid tx noise
|
|
|
|
pinMode(PWM_PIN, OUTPUT);
|
|
|
|
digitalWrite(PWM_PIN, LOW);
|
|
|
|
|
|
|
|
// prep the switch
|
|
|
|
pinMode(SWITCH_PIN, INPUT_PULLUP);
|
|
|
|
|
|
|
|
// set up the reset control pin
|
|
|
|
pinMode(RESET_PIN, OUTPUT);
|
|
|
|
// turn on radio
|
|
|
|
digitalWrite(RESET_PIN, HIGH);
|
|
|
|
|
2015-07-04 08:17:03 +00:00
|
|
|
radio.initialize();
|
|
|
|
radio.setRfPower(0);
|
|
|
|
radio.setFrequency(145060);
|
|
|
|
radio.setModeTransmit();
|
2015-07-01 23:56:40 +00:00
|
|
|
dds.start();
|
2015-07-02 00:05:17 +00:00
|
|
|
dds.playWait(600, 3000);
|
2015-07-01 23:56:40 +00:00
|
|
|
dds.on();
|
2015-07-04 08:17:03 +00:00
|
|
|
//dds.setAmplitude(31);
|
2015-07-01 23:56:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop() {
|
|
|
|
dds.setFrequency(2200);
|
2015-07-04 08:17:03 +00:00
|
|
|
delay(1000);
|
2015-07-01 23:56:40 +00:00
|
|
|
dds.setFrequency(1200);
|
2015-07-04 08:17:03 +00:00
|
|
|
delay(1000);
|
2015-07-01 23:56:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DDS_USE_ONLY_TIMER2
|
|
|
|
ISR(TIMER2_OVF_vect) {
|
|
|
|
dds.clockTick();
|
|
|
|
}
|
|
|
|
#else // Use the ADC timer instead
|
|
|
|
ISR(ADC_vect) {
|
2015-07-09 20:57:22 +00:00
|
|
|
static unsigned char tcnt = 0;
|
2015-07-01 23:56:40 +00:00
|
|
|
TIFR1 = _BV(ICF1); // Clear the timer flag
|
2015-07-09 20:57:22 +00:00
|
|
|
if(++tcnt == 4) {
|
2015-11-23 16:54:10 +00:00
|
|
|
//digitalWrite(2, HIGH);
|
2015-07-09 20:57:22 +00:00
|
|
|
tcnt = 0;
|
|
|
|
}
|
2015-07-01 23:56:40 +00:00
|
|
|
dds.clockTick();
|
2015-11-23 16:54:10 +00:00
|
|
|
//digitalWrite(2, LOW);
|
2015-07-01 23:56:40 +00:00
|
|
|
}
|
|
|
|
#endif
|