// morse sender - flash LED on 7 /* connections Arduino BT 5V PIN 2 (VCC) GND PIN 3 (GND) 10 (RXPIN) PIN 4 (TXD) - data transmitted from remote 11 (TXPIN) PIN 5 (RXD) - remote to receive this data */ #include "avr/pgmspace.h" #include "MorseEnDecoder.h" #include "SoftwareSerial.h" #define WPM 5 #define LEDPIN 7 #define RXPIN 10 #define TXPIN 11 morseEncoder morseOut(LEDPIN); SoftwareSerial GanymedeBT(RXPIN, TXPIN); // GanymedeBT class object in Arduino long lastTrans; long current; boolean ended = true; void setup() { pinMode(LEDPIN, OUTPUT); GanymedeBT.begin(9600); morseOut.setspeed(WPM); lastTrans = millis(); } void loop() { current = millis(); morseOut.encode(); if(GanymedeBT.available() && morseOut.available()) { char text = GanymedeBT.read(); GanymedeBT.write(text); // echo if(text == '\r') GanymedeBT.write('\n'); // when CR received addcq cq cq m6kwh NL morseOut.write(text); } if(!morseOut.available()) { lastTrans = current; ended = false; } }
To use this pair the module, then use the terminal"screen device" command to talk to it, or use the CoolTerm program.
No comments:
Post a Comment