updated for HS05

This commit is contained in:
morgan
2015-11-23 08:54:10 -08:00
parent a196501f15
commit 807617de83
24 changed files with 513 additions and 203 deletions

View File

@@ -11,6 +11,12 @@
#include <Wire.h>
#include <avr/wdt.h>
//TODO: move these into library
#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2
HamShield radio;
DDS dds;
String messagebuff = "";
@@ -20,16 +26,27 @@ String textmessage = "";
int msgptr = 0;
void setup() {
// 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 pwr to the radio
digitalWrite(RESET_PIN, HIGH);
Serial.begin(115200);
Wire.begin();
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
radio.initialize();
radio.frequency(144390);
radio.setRfPower(15);
radio.setRfPower(8);
dds.start();
radio.afsk.start(&dds);
pinMode(11, INPUT); // Bodge for now, as pin 3 is hotwired to pin 11
delay(100);
Serial.println("HELLO");
}

View File

@@ -11,6 +11,10 @@
#include <Wire.h>
#include <avr/wdt.h>
#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2
HamShield radio;
DDS dds;
String messagebuff = "";
@@ -20,16 +24,25 @@ String textmessage = "";
int msgptr = 0;
void setup() {
// 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 the radio
digitalWrite(RESET_PIN, HIGH);
Serial.begin(115200);
Wire.begin();
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
radio.initialize();
radio.frequency(145570);
radio.setRfPower(15);
dds.start();
radio.afsk.start(&dds);
pinMode(11, INPUT); // Bodge for now, as pin 3 is hotwired to pin 11
delay(100);
Serial.println("HELLO");
}
@@ -75,7 +88,7 @@ void prepMessage() {
if(radio.afsk.txReady()) {
Serial.println(F("txReady"));
radio.setModeTransmit();
//radio.setModeTransmit();
//delay(100);
if(radio.afsk.txStart()) {
Serial.println(F("txStart"));
@@ -97,14 +110,15 @@ void prepMessage() {
radio.setModeReceive();
}
// TODO: d2 is now our switch, so don't write to that
ISR(TIMER2_OVF_vect) {
TIFR2 = _BV(TOV2);
static uint8_t tcnt = 0;
if(++tcnt == 8) {
digitalWrite(2, HIGH);
//digitalWrite(2, HIGH);
dds.clockTick();
digitalWrite(2, LOW);
//digitalWrite(2, LOW);
tcnt = 0;
}
}
@@ -112,7 +126,7 @@ ISR(TIMER2_OVF_vect) {
ISR(ADC_vect) {
static uint8_t tcnt = 0;
TIFR1 = _BV(ICF1); // Clear the timer flag
PORTD |= _BV(2); // Diagnostic pin (D2)
//PORTD |= _BV(2); // Diagnostic pin (D2)
dds.clockTick();
if(++tcnt == 1) {
if(radio.afsk.encoder.isSending()) {
@@ -120,7 +134,7 @@ ISR(ADC_vect) {
}
tcnt = 0;
}
PORTD &= ~(_BV(2)); // Pin D2 off again
//PORTD &= ~(_BV(2)); // Pin D2 off again
}

View File

@@ -4,19 +4,33 @@
HamShield radio;
DDS dds;
#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2
#define DON(p) PORTD |= _BV((p))
#define DOFF(p) PORTD &= ~(_BV((p)))
void setup() {
Serial.begin(9600);
Wire.begin();
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
// 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 pwr to the radio
digitalWrite(RESET_PIN, HIGH);
Serial.println(F("Radio test connection"));
Serial.println(radio.testConnection(), DEC);
Serial.println(F("Initialize"));
@@ -24,14 +38,12 @@ void setup() {
radio.initialize();
Serial.println(F("Frequency"));
delay(100);
radio.setVHF();
radio.frequency(145010);
//radio.setRfPower(0);
delay(100);
dds.start();
delay(100);
radio.afsk.start(&dds);
pinMode(11, INPUT); // Bodge for now, as pin 3 is hotwired to pin 11
delay(100);
dds.setFrequency(0);
dds.on();

View File

@@ -1,24 +1,35 @@
#include <HamShield.h>
#include <Wire.h>
#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2
HamShield radio;
DDS dds;
void setup() {
// 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);
Serial.begin(9600);
Wire.begin();
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
Serial.println(F("Radio test connection"));
Serial.println(radio.testConnection(), DEC);
Serial.println(F("Initialize"));
delay(100);
radio.initialize();
radio.frequency(145010);
radio.setVHF();
radio.setSQOff();
I2Cdev::writeWord(A1846S_DEV_ADDR_SENLOW, 0x30, 0x06);
I2Cdev::writeWord(A1846S_DEV_ADDR_SENLOW, 0x30, 0x26);
I2Cdev::writeWord(A1846S_DEV_ADDR_SENLOW, 0x44, 0b11111111);
Serial.println(F("Frequency"));
delay(100);
@@ -36,7 +47,6 @@ void setup() {
delay(100);
radio.afsk.start(&dds);
Serial.println(F("Starting..."));
pinMode(11, INPUT); // Bodge for now, as pin 3 is hotwired to pin 11
delay(100);
dds.setAmplitude(255);
}
@@ -57,11 +67,12 @@ void loop() {
}
}
//TODO: d2 is the switch input, so remove this
ISR(ADC_vect) {
static uint8_t tcnt = 0;
TIFR1 = _BV(ICF1); // Clear the timer flag
PORTD |= _BV(2); // Diagnostic pin (D2)
//PORTD |= _BV(2); // Diagnostic pin (D2)
//dds.clockTick();
radio.afsk.timer();
PORTD &= ~(_BV(2)); // Pin D2 off again
//PORTD &= ~(_BV(2)); // Pin D2 off again
}

View File

@@ -5,21 +5,32 @@
#include <HamShield.h>
#include <Wire.h>
#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2
HamShield radio;
DDS dds;
void setup() {
// 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);
Serial.begin(9600);
Wire.begin();
radio.initialize();
radio.setVHF();
radio.setRfPower(0);
radio.setFrequency(145050);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(11, INPUT);
dds.start();
dds.setFrequency(1200);
dds.on();
@@ -236,7 +247,7 @@ ISR(ADC_vect) {
static uint8_t lastADC = 127;
cli();
TIFR1 = _BV(ICF1);
PORTD |= _BV(2);
//PORTD |= _BV(2);
dds.clockTick();
sei();
if(listening) {
@@ -255,5 +266,5 @@ ISR(ADC_vect) {
}
lastADC = ADCH;
}
PORTD &= ~_BV(2);
//PORTD &= ~_BV(2);
}

View File

@@ -2,18 +2,31 @@
#include <HamShield.h>
#include <Wire.h>
#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2
HamShield radio;
DDS dds;
void setup() {
// 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);
Wire.begin();
radio.initialize();
radio.setRfPower(0);
radio.setVHF();
radio.setFrequency(145060);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(11, INPUT);
radio.setModeTransmit();
dds.start();
dds.playWait(600, 3000);
@@ -37,10 +50,10 @@ ISR(ADC_vect) {
static unsigned char tcnt = 0;
TIFR1 = _BV(ICF1); // Clear the timer flag
if(++tcnt == 4) {
digitalWrite(2, HIGH);
//digitalWrite(2, HIGH);
tcnt = 0;
}
dds.clockTick();
digitalWrite(2, LOW);
//digitalWrite(2, LOW);
}
#endif

View File

@@ -9,11 +9,26 @@ Beacon will check to see if the channel is clear before it will transmit.
#include <HamShield.h>
#include <Wire.h>
#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2
// Create a new instance of our HamSheild class, called 'radio'
HamShield radio;
// Run our start up things here
void setup() {
// 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);
digitalWrite(RESET_PIN, HIGH);
// Set up the serial port at 9600 Baud
Serial.begin(9600);
@@ -30,10 +45,9 @@ void setup() {
// Tell the HamShield to start up
radio.initialize();
radio.setRfPower(15);
radio.setRfPower(8);
// Configure the HamShield to transmit and recieve on 446.000MHz
radio.frequency(145570);
pinMode(11, INPUT); // Bodge for now, as pin 3 is hotwired to pin 11
Serial.println("Radio Configured.");
}

View File

@@ -3,6 +3,10 @@
#include <HAMShield.h>
#include <Wire.h>
#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2
// transmit for 1 minute, every 10 minutes
#define TRANSMITLENGTH 1
@@ -11,7 +15,18 @@
HAMShield radio;
void setup() {
void setup() {
// 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);
digitalWrite(RESET_PIN, HIGH);
Wire.begin();
radio.initialize();
radio.setFrequency(145510);

View File

@@ -3,9 +3,24 @@
#include <HamShield.h>
#include <Wire.h>
#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2
HamShield radio;
void setup() {
// 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);
digitalWrite(RESET_PIN, HIGH);
Wire.begin();
Serial.begin(9600);
Serial.println("If the sketch freezes at radio status, there is something wrong with power or the shield");

View File

@@ -10,6 +10,10 @@ Simple gauges for the radio receiver.
#include <HAMShield.h>
#include <Wire.h>
#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2
HAMShield radio;
void clr() {
@@ -19,7 +23,18 @@ void clr() {
Serial.print("[H"); // cursor to home command
}
void setup() {
void setup() {
// 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);
digitalWrite(RESET_PIN, HIGH);
analogReference(DEFAULT);
Serial.begin(115200);
Wire.begin();

View File

@@ -5,13 +5,28 @@
#include <Wire.h>
#include <SPI.h>
#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2
HAMShield radio;
void setup() {
void setup() {
// 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);
digitalWrite(RESET_PIN, HIGH);
Robot.begin();
Wire.begin();
radio.initialize();
radio.setFrequency(145510);
radio.frequency(145510);
}
void loop() {

View File

@@ -6,11 +6,16 @@ Arduino audio overlay example
*/
#include <HAMShield.h>
#include <Wire.h>
#define DOT 100
#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2
HAMShield radio;
const char *bascii = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,?'!/()&:;=+-_\"$@",
@@ -21,7 +26,18 @@ const char *callsign = {"1ZZ9ZZ/B"} ;
char morsebuffer[8];
void setup() {
void setup() {
// 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);
digitalWrite(RESET_PIN, HIGH);
Serial.begin(9600);
Serial.println("starting up..");
Wire.begin();
@@ -29,7 +45,7 @@ void setup() {
int result = radio.testConnection();
Serial.println(result,DEC);
radio.initialize();
radio.setFrequency(446000);
radio.frequency(446000);
radio.setVolume1(0xF);
radio.setVolume2(0xF);
radio.setModeReceive();

View File

@@ -3,9 +3,24 @@
#include <HamShield.h>
#include <Wire.h>
#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2
HamShield radio;
void setup() {
// 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);
digitalWrite(RESET_PIN, HIGH);
Wire.begin();
Serial.begin(9600);
Serial.println("If the sketch freezes at radio status, there is something wrong with power or the shield");

View File

@@ -6,20 +6,35 @@ HamShield radio;
DDS dds;
KISS kiss(&Serial, &radio, &dds);
//TODO: move these into library
#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2
void setup() {
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(11, INPUT);
// 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);
digitalWrite(RESET_PIN, LOW);
Serial.begin(9600);
while (digitalRead(SWITCH_PIN));
// let the AU ot of reset
digitalWrite(RESET_PIN, HIGH);
Wire.begin();
radio.initialize();
radio.setVHF();
radio.setSQOff();
radio.setFrequency(145010);
I2Cdev::writeWord(A1846S_DEV_ADDR_SENLOW, 0x30, 0x06);
I2Cdev::writeWord(A1846S_DEV_ADDR_SENLOW, 0x30, 0x26);
I2Cdev::writeWord(A1846S_DEV_ADDR_SENLOW, 0x44, 0x05FF);
radio.setFrequency(144390);
//I2Cdev::writeWord(A1846S_DEV_ADDR_SENLOW, 0x44, 0x05FF);
dds.start();
radio.afsk.start(&dds);

View File

@@ -1,13 +1,25 @@
#include <HamShield.h>
#include "varicode.h"
#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2
DDS dds;
void setup() {
// 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);
digitalWrite(RESET_PIN, HIGH);
Serial.begin(9600);
pinMode(11, OUTPUT);
pinMode(3, OUTPUT);
pinMode(2, OUTPUT);
// put your setup code here, to run once:
dds.setReferenceClock(32000);
dds.start();
@@ -65,7 +77,7 @@ ISR(ADC_vect) {
if(tcnt > (255-81))
dds.setAmplitude(amplitudeShape[(tcnt-174)/2]);
dds.clockTick();
PORTD &= ~_BV(2);
//PORTD &= ~_BV(2);
if(outer++ == 3) {
outer = 0;
} else {
@@ -89,5 +101,5 @@ ISR(ADC_vect) {
dds.changePhaseDeg(+180);
}
}
PORTD &= ~_BV(2);
//PORTD &= ~_BV(2);
}

View File

@@ -9,6 +9,10 @@ A bit robotic and weird
#include <HAMShield.h>
#include <Wire.h>
#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2
#define RATE 500
#define SIZE 1500
@@ -21,6 +25,17 @@ int16_t rssi;
byte mode = 8;
void setup() {
// 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);
digitalWrite(RESET_PIN, HIGH);
Wire.begin();
// int result = radio.testConnection();
radio.initialize();

View File

@@ -1,13 +1,26 @@
#include <HamShield.h>
#include "varicode.h"
#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2
DDS dds;
void setup() {
// 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);
digitalWrite(RESET_PIN, LOW);
Serial.begin(9600);
pinMode(11, OUTPUT);
pinMode(3, OUTPUT);
pinMode(2, OUTPUT);
// put your setup code here, to run once:
dds.setReferenceClock(32000);
dds.start();

View File

@@ -4,6 +4,10 @@ Sends an SSTV test pattern
*/
#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2
#define DOT 100
#define CALLSIGN "1ZZ9ZZ/B"
@@ -17,14 +21,25 @@ int16_t rssi;
/* get our radio ready */
void setup() {
void setup() {
// 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);
digitalWrite(RESET_PIN, HIGH);
Wire.begin();
Serial.begin(9600);
Serial.print("Radio status: ");
int result = radio.testConnection();
Serial.println(result);
radio.initialize();
radio.setFrequency(446000);
radio.frequency(446000);
radio.setModeReceive();
}

View File

@@ -4,6 +4,10 @@
#include <HamShield.h>
#include <Wire.h>
#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2
HamShield radio;
DDS dds;
// Defined at the end of the sketch
@@ -15,6 +19,17 @@ extern const uint16_t image[256*20] PROGMEM;
ddsAccumulator_t freqTable[3];
void setup() {
// 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);
digitalWrite(RESET_PIN, HIGH);
Serial.begin(9600);
Wire.begin();
// Query the HamShield for status information
@@ -26,11 +41,7 @@ void setup() {
// Tell the HamShield to start up
radio.initialize();
radio.setRfPower(0);
radio.setVHF();
radio.setFrequency(145500);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(11, INPUT); // HiZ
radio.frequency(145500);
// put your setup code here, to run once:
//dds.setReferenceClock(34965/4);
dds.start();

View File

@@ -49,6 +49,10 @@ Debug Msg @<text>; 32 character debug message
#include "Wire.h"
#include "HamShield.h"
#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2
int state;
int txcount = 0;
long timer = 0;
@@ -68,6 +72,17 @@ HamShield radio;
void setup() {
// 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);
digitalWrite(RESET_PIN, HIGH);
Serial.begin(115200);
Serial.print(";;;;;;;;;;;;;;;;;;;;;;;;;;");
Wire.begin();

View File

@@ -14,6 +14,10 @@ Plays back the current signal strength level and morses out it's call sign at th
#include <Wire.h>
#include <PCM.h>
#define PWM_PIN 3
#define RESET_PIN A3
#define SWITCH_PIN 2
HAMShield radio;
int16_t rssi;
int peak = -150;
@@ -73,14 +77,25 @@ const unsigned char dbm[] PROGMEM = {
/* get our radio ready */
void setup() {
void setup() {
// 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);
digitalWrite(RESET_PIN, HIGH);
Wire.begin();
Serial.begin(9600);
Serial.print("Radio status: ");
int result = radio.testConnection();
Serial.println(result);
radio.initialize();
radio.setFrequency(446000);
radio.frequency(446000);
radio.setVolume1(0xF);
radio.setVolume2(0xF);
radio.setModeReceive();
@@ -104,7 +119,7 @@ void loop() {
if(rssi < -120) {
Serial.println("Transmit On");
radio.setTX(1);
radio.setModeTransmit();
delay(250);
tone(11,1000,500);
delay(1000);
@@ -131,9 +146,8 @@ void loop() {
delay(1000);
Serial.println("done!");
radio.morseOut(CALLSIGN);
radio.setTX(0);
Serial.println("Transmit off");
radio.setModeReceive();
Serial.println("Transmit off");
delay(1000);
}
}