The output of the program is a TTL signal an Arduino pin. This must be used to drive an external oscillator if audio is required, it can drive a relay directly to key a transmitter if no local audio is required - or it could do both!
The oscillator circuit uses a TTL 74LS00:
Here's the code:
// sends TTL signal on OSCPIN to a TTL external osillator
// input from Serial Monitor, "string_to_send CR"
#include "avr/pgmspace.h"
#include "MorseEnDecoder.h"
#define WPM 5
#define OSCPIN 7
// morseOut class
morseEncoder morseOut(OSCPIN);
// timing
long lastTrans;
long current;
boolean ended = true;
void setup() {
pinMode(OSCPIN, OUTPUT);
Serial.begin(9600);
morseOut.setspeed(WPM);
lastTrans = millis();
}
void loop() {
current = millis();
morseOut.encode(); // must call once per loop
if(Serial.available() && morseOut.available()) {
char letter = Serial.read(); // read the next letter
morseOut.write(letter); // send the letter
}
if(!morseOut.available()) {
lastTrans = current;
ended = false;
}
}
No comments:
Post a Comment