/*
* Morse code simuator for the MSP430
*
*
*
*/
#define LED RED_LED
int dt = 100; // the "time unit"
// A dirty way
int a[] = {2,1,3};
int b[] = {4,3,1,1,1};
int c[]= {4,3,1,3,1};
int d[] = {3,3,1,1};
int e[] = {1,1};
int f[] = {4,1,1,3,1};
int g[] = {3,3,3,1};
int h[] = {4,1,1,1,1};
int i[] = {2,1,1};
int j[] = {4,1,3,3,3};
int k[] = {3,3,1,3};
int l[] = {4,1,3,1,1};
int m[] = {2,3,3};
int n[] = {2,3,1};
int o[] = {3,3,3,3};
int p[] = {4,1,3,3,1};
int q[] = {4,3,3,1,3};
int r[] = {3,1,3,1};
int s[] = {3,1,1,1};
int t[] = {1,3};
int u[] = {3,1,1,3};
int v[] = {4,1,1,1,3};
int w[] = {3,1,3,3};
int x[] = {4,3,1,1,3};
int y[] = {4,3,1,3,3};
int z[] = {4,3,3,1,1};
int sp[]= {3,0,0,0};
void setup() {
pinMode(LED, OUTPUT);
Serial.begin(9600);
}
void loop() {
toMorse(i);
delay(4*dt);
toMorse(l);
toMorse(o);
toMorse(v);
toMorse(e);
delay(4*dt);
toMorse(y);
toMorse(o);
toMorse(u);
delay(11*dt);
}
void toMorse(int letter[]){
int len = letter[0];
for(int ind = 1; ind < len + 1; ind = ind+1){
digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level)
delay(dt*letter[ind]); // wait for a second
digitalWrite(LED, LOW); // turn the LED off by making the voltage LOW
delay(dt); // wait for a second
}
Serial.println(" ");
delay(3*dt);
}