/* MANOA_LOGIC by Steve.Bull@gmail.com 2012 December 7 */ /*morse_code_simple_by_mark // Simple Arduino Morse Beacon // Written by Mark VandeWettering K6HX // Email: k6hx@arrl.net */ /* Button Tutorial created 2005 by DojoDave modified 30 Aug 2011 by Tom Igoe * This example code is in the public domain. http://www.arduino.cc/en/Tutorial/Button */ struct t_mtab { char c, pat; } ; struct t_mtab morsetab[] = { {'.', 106}, {',', 115}, {'?', 76}, {'/', 41}, {'A', 6}, {'B', 17}, {'C', 21}, {'D', 9}, {'E', 2}, {'F', 20}, {'G', 11}, {'H', 16}, {'I', 4}, {'J', 30}, {'K', 13}, {'L', 18}, {'M', 7}, {'N', 5}, {'O', 15}, {'P', 22}, {'Q', 27}, {'R', 10}, {'S', 8}, {'T', 3}, {'U', 12}, {'V', 24}, {'W', 14}, {'X', 25}, {'Y', 29}, {'Z', 19}, {'1', 62}, {'2', 60}, {'3', 56}, {'4', 48}, {'5', 32}, {'6', 33}, {'7', 35}, {'8', 39}, {'9', 47}, {'0', 63} } ; #define N_MORSE (sizeof(morsetab)/sizeof(morsetab[0])) #define SPEED (12) // reasonably frisky morse code speed with original example // #define SPEED (4) // SB: Make the speed more like a lighted bouy at a harbor entrance #define DOTLEN (1200/SPEED) #define DASHLEN (3*(1200/SPEED)) // constants won't change. They're used here to // set pin numbers: const int BUTTONpin = 2; // the number of the pushbutton pin const int SWITCH1pin = 3; // the number of the switch pin const int SWITCH2pin = 5; // the number of the switch pin const int SWITCH3pin = 7; // the number of the switch pin // const int int LEDpin12 = 12 ; // output pin of the bright white LED // decalring variables that will change later int buttonState = 0; // variable for reading the pushbutton status int switch1State = 0; int switch2State = 0; int switch3State = 0; // void // dash() { digitalWrite(LEDpin12, HIGH) ; tone(8,1000) ; delay(DASHLEN) ; digitalWrite(LEDpin12, LOW) ; noTone(8) ; delay(DOTLEN) ; } void dit() { digitalWrite(LEDpin12, HIGH) ; tone(8,1000) ; delay(DOTLEN); digitalWrite(LEDpin12, LOW) ; noTone(8) ; delay(DOTLEN); } void send(char c) { int i ; if (c == ' ') { Serial.print(c) ; delay(7*DOTLEN) ; return ; } for (i=0; i") ; Serial.println("") ; Serial.println("Thank you for Switch code via Tom Igoe") ; Serial.println("") ; */ } // void loop(){ // read the state of the pushbutton value: buttonState = digitalRead(BUTTONpin); switch1State = digitalRead(SWITCH1pin); switch2State = digitalRead(SWITCH2pin); switch3State = digitalRead(SWITCH3pin); // check if the pushbutton is pressed. // if it is, the buttonState is HIGH: if (buttonState == HIGH) { // turn pin 13 LED on: // digitalWrite(LEDpin13, HIGH); // nested if statements follow // 1 + 2 + 3 + 4 if (switch1State == LOW) { // begin read initial switch state Serial.println(switch1State) ; Serial.println(switch2State) ; Serial.println(switch3State) ; // if(switch2State == LOW) { // 1 pattern 000 if(switch3State == LOW) { // lyrics to famous 'ukulele song by David Kalakaua // more info on King Kalakaua at http://www.hawaiihistory.org/index.cfm?fuseaction=ig.page&PageID=404 // and http://en.wikipedia.org/wiki/Kal%C4%81kaua sendmsg("HAWAII PONOI BY KING KALAKAUA. HAWAII PONOI, NANA I KOU MOI, KA LANI ALII, KE ALII, MAKUA LANIE KAMEHAMEHA E, NA KAUA E PALE ME KA IHE.") ; Serial.println(switch1State) ; Serial.println(switch2State) ; Serial.println(switch3State) ; } // 2 pattern 001 if(switch3State == HIGH) { // sendmsg("EE"); // message sent by morse code operator of SS Titanic while sinking // sourced at http://www.modestoradiomuseum.org/titanic%20cqd%20code.html sendmsg("CQD CQD SOS TITANIC POSITION 41.44 N 50.24 W. REQUIRE IMMEDIATE ASSISTANCE. COME AT ONCE. WE STRUCK AN ICEBERG. SINKING.") ; Serial.println(switch1State) ; Serial.println(switch2State) ; Serial.println(switch3State) ; } } if(switch2State == HIGH) { // 3 pattern 010 if(switch3State == LOW) { // sendmsg("EEE") ; // MORSE CODE TONE POEM WITH PERSONAL RESONANCE, someday I will writre more on this.... lyrics from TOMMY http://en.wikipedia.org/wiki/Tommy_%28album%29 sendmsg("SEE ME FEEL ME TOUCH ME HEAL ME") ; Serial.println(switch1State) ; Serial.println(switch2State) ; Serial.println(switch3State) ; } // 4 pattern 011 if(switch3State == HIGH) { // sendmsg("EEEE") ; // easy to understand message for the Morse code listener/learner // TEE = - . . (T = single dash, E = single dot) sendmsg("TEE") ; Serial.println(switch1State) ; Serial.println(switch2State) ; Serial.println(switch3State) ; } } // } // // // // 5 + 6 + 7 + 8 if (switch1State == HIGH) { // begin read initial switch state Serial.println(switch1State) ; Serial.println(switch2State) ; Serial.println(switch3State) ; // if(switch2State == LOW) { // 5 pattern 100 if(switch3State == LOW) { //sendmsg("EEEE E") ; // homage to the bard as well as another easy message for the Morse code listener/learner to decode sendmsg("TO BE OR NOT TO BE") ; Serial.println(switch1State) ; Serial.println(switch2State) ; Serial.println(switch3State) ; } // 6 pattern 101 if(switch3State == HIGH) { // sendmsg("EEEE EE"); // one of the audio messages on space craft VOYAGER now traveling in space beyond Earth's galaxy // http://en.wikipedia.org/wiki/Contents_of_the_Voyager_Golden_Record Sumerian sendmsg("MAY ALL BE WELL") ; Serial.println(switch1State) ; Serial.println(switch2State) ; Serial.println(switch3State) ; } } if(switch2State == HIGH) { // 7 pattern 110 if(switch3State == LOW) { // sendmsg("EEEE EEE") ; // one of the audio messages on space craft VOYAGER now traveling in space beyond Earth's galaxy // http://en.wikipedia.org/wiki/Contents_of_the_Voyager_Golden_Record GREEK sendmsg("GREETINGS TO YOU WHOEVER YOU ARE. WE COME IN FRIENDSHIP TO THOSE WHO ARE FRIENDS") ; Serial.println(switch1State) ; Serial.println(switch2State) ; Serial.println(switch3State) ; } // 8 pattern 111 if(switch3State == HIGH) { // sendmsg("EEEE EEEE") ; // ABD Morse code tutorial sendmsg("A B C D E F G H I J K L M N O P Q R S T U V W X Y Z") ; Serial.println(switch1State) ; Serial.println(switch2State) ; Serial.println(switch3State) ; } } // } } else { // DO NOTHING - - JUST WAIT :)s // turn pin 13 LED off: // digitalWrite(LEDpin13, LOW); // sendmsg("S") ; // delay(8000) ; } } // ALOHA // THE END