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.
Dependencies: mbed 4DGL-uLCD-SE
Fork of morseCode_1 by
Diff: Header_file.h
- Revision:
- 6:421ece74143e
- Parent:
- 5:5b86521e418c
- Child:
- 7:5a902d88277a
--- a/Header_file.h Sun Apr 29 01:04:11 2018 +0000 +++ b/Header_file.h Sun Apr 29 16:57:29 2018 +0000 @@ -31,18 +31,19 @@ wait(0.5); } +//I commented out the debug outputs since I solved the problem of what was wrong but it could be nice to keep around, I guess void Text_to_morse(char input_char){ //function takes in characters at a time. call dot & dash appropriately for detected char //int w = 0.5; //wait duration in-between led blinks and speaker clicks - uLCD.printf("input: %c\n",input_char); + //uLCD.printf("input: %c\n",input_char); //Debug output, feel free to comment out if(input_char == 'a' || input_char == 'A'){ - uLCD.printf("a\n"); + //uLCD.printf("a\n"); dot(); //wait(w); //wait 0.5s in between dash(); //wait(w); } else if(input_char == 'b' || input_char == 'B'){ - uLCD.printf("b\n"); + //uLCD.printf("b\n"); dash(); //wait(w); dot(); @@ -53,7 +54,7 @@ //wait(w); } else if(input_char == 'c'||input_char == 'C'){ - uLCD.printf("c\n"); + //uLCD.printf("c\n"); dash(); //wait(w); dot(); @@ -64,7 +65,7 @@ //wait(w); } else if(input_char == 'd'||input_char == 'D'){ - uLCD.printf("d\n"); + //uLCD.printf("d\n"); dash(); //wait(w); dot(); @@ -72,12 +73,12 @@ dot(); //wait(w); }else if(input_char == 'e'||input_char == 'E'){ - uLCD.printf("e\n"); + //uLCD.printf("e\n"); dot(); //wait(w); } else if(input_char == 'f'||input_char == 'F'){ - uLCD.printf("f\n"); + //uLCD.printf("f\n"); dot(); //wait(w); dot(); @@ -88,7 +89,7 @@ //wait(w); } else if(input_char == 'g'||input_char == 'G'){ - uLCD.printf("g\n"); + //uLCD.printf("g\n"); dash(); //wait(w); dash(); @@ -97,7 +98,7 @@ //wait(w); } else if(input_char == 'h'||input_char == 'H'){ - uLCD.printf("h\n"); + //uLCD.printf("h\n"); dot(); //wait(w); dot(); @@ -108,14 +109,14 @@ //wait(w); } else if(input_char == 'i'||input_char == 'I'){ - uLCD.printf("i\n"); + //uLCD.printf("i\n"); dot(); //wait(w); dot(); //wait(w); } else if(input_char == 'j'||input_char == 'J'){ - uLCD.printf("j\n"); + //uLCD.printf("j\n"); dot(); //wait(w); dash(); @@ -126,7 +127,7 @@ //wait(w); } else if(input_char == 'k'||input_char == 'K'){ - uLCD.printf("k\n"); + //uLCD.printf("k\n"); dash(); //wait(w); dot(); @@ -135,7 +136,7 @@ //wait(w); } else if(input_char == 'l'||input_char == 'L'){ - uLCD.printf("l\n"); + //uLCD.printf("l\n"); dot(); //wait(w); dash(); @@ -146,21 +147,21 @@ //wait(w); } else if(input_char == 'm'||input_char == 'M'){ - uLCD.printf("m\n"); + //uLCD.printf("m\n"); dash(); //wait(w); dash(); //wait(w); } else if(input_char == 'n'||input_char == 'N'){ - uLCD.printf("n\n"); + //uLCD.printf("n\n"); dash(); //wait(w); dot(); //wait(w); } else if(input_char == 'o'|| input_char == 'O'){ - uLCD.printf("o\n"); + //uLCD.printf("o\n"); //testled = 1; dash(); //wait(2); @@ -171,7 +172,7 @@ //testled = 0; } else if(input_char == 'p'||input_char == 'P'){ - uLCD.printf("p\n"); + //uLCD.printf("p\n"); dot(); //wait(w); dash(); @@ -182,20 +183,20 @@ //wait(w); } else if(input_char == 'q'||input_char == 'Q'){ - uLCD.printf("q\n"); + //uLCD.printf("q\n"); dash(); dash(); dot(); dash(); } else if(input_char == 'r'||input_char == 'R'){ - uLCD.printf("r\n"); + //uLCD.printf("r\n"); dot(); dash(); dot(); } else if(input_char == 's'||input_char == 'S'){ - uLCD.printf("s\n"); + //uLCD.printf("s\n"); //otherled = 1; dot(); dot(); @@ -203,44 +204,44 @@ //otherled = 0; } else if(input_char == 't'||input_char == 'T'){ - uLCD.printf("t\n"); + //uLCD.printf("t\n"); dash(); } else if(input_char == 'u'||input_char == 'U'){ - uLCD.printf("u\n"); + //uLCD.printf("u\n"); dot(); dot(); dash(); } else if(input_char == 'v'||input_char == 'V'){ - uLCD.printf("v\n"); + //uLCD.printf("v\n"); dot(); dot(); dot(); dash(); } else if(input_char == 'w'||input_char == 'W'){ - uLCD.printf("w\n"); + //uLCD.printf("w\n"); dot(); dash(); dash(); } else if(input_char == 'x'||input_char == 'X'){ - uLCD.printf("x\n"); + //uLCD.printf("x\n"); dash(); dot(); dot(); dash(); } else if(input_char == 'y'||input_char == 'Y'){ - uLCD.printf("y\n"); + //uLCD.printf("y\n"); dash(); dot(); dash(); dash(); } else if(input_char == 'z'||input_char == 'Z'){ - uLCD.printf("z\n"); + //uLCD.printf("z\n"); dash(); dash(); dot(); @@ -337,6 +338,11 @@ //Inserting an item on the "dot" side of a node //Adds the value, and pointers go to NULL + +//The current intent is that by pointing to a NULL type, we can know when to top traversing. +//I see our telegraph key having a separate function that will return a Tree node when traversing +//But if a NULL is pointed to next, then it'll return the node that it's already looking at +//If any of these comments make sense void Tree::insertdot(char newValue, Tree *rootNode){ rootNode->dot = new Tree; rootNode->dot->value = newValue; @@ -346,6 +352,7 @@ } //Inserting an item on the "dash" side of a node +//See above for more comments/documentation void Tree::insertdash(char newValue, Tree *rootNode){ rootNode->dash = new Tree; rootNode->dash->value = newValue; @@ -354,6 +361,7 @@ return; } +//Return char type value stored in a given node char returnvalue(Tree *rootNode){ return rootNode->value; }