From 8c90a134ad471b86bace01dc889e98ad4f946067 Mon Sep 17 00:00:00 2001 From: Nigel Vander Houwen Date: Sun, 5 Jun 2016 12:41:35 -0700 Subject: [PATCH] Fixed FMBeacon example, required slight modification to library. TO-DO notes in example header. --- HamShield.cpp | 13 +++++++++---- examples/FMBeacon/FMBeacon.ino | 13 ++++++++----- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/HamShield.cpp b/HamShield.cpp index d2b49d0..50d7a10 100644 --- a/HamShield.cpp +++ b/HamShield.cpp @@ -1288,10 +1288,13 @@ void HamShield::morseOut(char buffer[HAMSHIELD_MORSE_BUFFER_SIZE]) { if(buffer[i] == ' ') { // We delay by 4 here, if we previously sent a symbol. Otherwise 7. // This could probably just be always 7 and go relatively unnoticed. - if(prev == 0 || prev == ' ') + if(prev == 0 || prev == ' '){ + tone(HAMSHIELD_PWM_PIN, 6000, HAMSHIELD_MORSE_DOT * 7); delay(HAMSHIELD_MORSE_DOT*7); - else + } else { + tone(HAMSHIELD_PWM_PIN, 6000, HAMSHIELD_MORSE_DOT * 4); delay(HAMSHIELD_MORSE_DOT*4); + } continue; } // Otherwise, lookup our character symbol @@ -1299,17 +1302,19 @@ void HamShield::morseOut(char buffer[HAMSHIELD_MORSE_BUFFER_SIZE]) { if(bits) { // If it is a valid character... do { if(bits & 1) { - tone(HAMSHIELD_PWM_PIN, 1000, HAMSHIELD_MORSE_DOT * 3); + tone(HAMSHIELD_PWM_PIN, 600, HAMSHIELD_MORSE_DOT * 3); delay(HAMSHIELD_MORSE_DOT*3); } else { - tone(HAMSHIELD_PWM_PIN, 1000, HAMSHIELD_MORSE_DOT); + tone(HAMSHIELD_PWM_PIN, 600, HAMSHIELD_MORSE_DOT); delay(HAMSHIELD_MORSE_DOT); } + tone(HAMSHIELD_PWM_PIN, 6000, HAMSHIELD_MORSE_DOT); delay(HAMSHIELD_MORSE_DOT); bits >>= 1; // Shift into the next symbol } while(bits != 1); // Wait for 1 termination to be all we have left } // End of character + tone(HAMSHIELD_PWM_PIN, 6000, HAMSHIELD_MORSE_DOT * 3); delay(HAMSHIELD_MORSE_DOT * 3); } return; diff --git a/examples/FMBeacon/FMBeacon.ino b/examples/FMBeacon/FMBeacon.ino index eac2238..0398d48 100644 --- a/examples/FMBeacon/FMBeacon.ino +++ b/examples/FMBeacon/FMBeacon.ino @@ -3,16 +3,18 @@ Morse Code Beacon Test beacon will transmit and wait 30 seconds. Beacon will check to see if the channel is clear before it will transmit. + +TO-DO: Radio chip audio AGC too slow in responding to tones, worked around by playing a 6khz tone between actual dits/dahs. +Should work on adjusting AGC to not require this. */ -// Include the HamSheild +#define DDS_REFCLK_DEFAULT 9600 #include #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 @@ -42,8 +44,9 @@ void setup() { // Tell the HamShield to start up radio.initialize(); radio.setRfPower(0); + // Configure the HamShield to transmit and recieve on 446.000MHz - radio.frequency(145570); + radio.frequency(438000); Serial.println("Radio Configured."); } @@ -60,13 +63,13 @@ void loop() { radio.setModeTransmit(); // Send a message out in morse code - radio.morseOut("KC7IBT ARDUINO HAMSHIELD"); + radio.morseOut(" KC7IBT ARDUINO HAMSHIELD"); // We're done sending the message, set the radio back into recieve mode. radio.setModeReceive(); Serial.println("Done."); - // Wait 30 seconds before we send our beacon again. + // Wait a second before we send our beacon again. delay(1000); } else { // If we get here, the channel is busy. Let's also print out the RSSI.