Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of slider_diatonic_v1 by
Revision 1:6f0197189fcc, committed 2014-12-19
- Comitter:
- scohennm
- Date:
- Fri Dec 19 16:34:51 2014 +0000
- Parent:
- 0:6c16ec0e7b9d
- Child:
- 2:7f347d6a6422
- Commit message:
- Iambic keyer for Morse code with iambic paddle. Added a side tone using PWM @50% DF changing the cycle period to make a 700 Hz tone.
Changed in this revision
| keyer_test_v3.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/keyer_test_v3.cpp Tue Dec 16 03:14:27 2014 +0000
+++ b/keyer_test_v3.cpp Fri Dec 19 16:34:51 2014 +0000
@@ -14,7 +14,7 @@
#define IAMMESS "IAMB"
#define NULLMESS "111" // LCD idle message
#define FIXEDWPM 13
-#define LOWSPEED 5
+#define LOWSPEED 5
#define SPPEDINT 25.0 // This gives a max speed of 30 - 5 + 25
#define STATECOEF 2
@@ -22,6 +22,9 @@
#define DIT 1
#define DAH 2
#define IAM 3
+#define SIDETONE 0.0014 //seconds
+#define TONEON 0.50
+#define TONEOFF 0.0
SLCD slcd; //define LCD display
// keyer test
@@ -32,6 +35,7 @@
DigitalIn DitPaddle(PTD6);
DigitalOut led(LED_RED);
DigitalOut outPin(PTC9); //J1-16
+PwmOut soundOut(PTC9);
int KeyState = IDLE;
@@ -44,9 +48,11 @@
void makeDit (float dotLen,DigitalOut outChannel, DigitalOut cloneChannel) {
outChannel.write(CHANNELON);
cloneChannel.write(CHANNELON);
+ soundOut.write(TONEON);
wait(dotLen);
outChannel.write(CHANNELOFF);
cloneChannel.write(CHANNELOFF);
+ soundOut.write(TONEOFF);
wait(float(DOT)*dotLen);
return;
}
@@ -54,9 +60,11 @@
void makeDah (float dotLen,DigitalOut outChannel, DigitalOut cloneChannel) {
outChannel.write(CHANNELON);
cloneChannel.write(CHANNELON);
+ soundOut.write(TONEON);
wait(float(DASH)*dotLen);
outChannel.write(CHANNELOFF);
cloneChannel.write(CHANNELOFF);
+ soundOut.write(TONEOFF);
wait(float(DOT)*dotLen);
return;
}
@@ -73,6 +81,8 @@
float tempValue;
int lastKeyHit = DIT;
+ soundOut.period(SIDETONE);
+
elementLen = BASESPEED / (float) wpm;
