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
main.cpp@5:5b86521e418c, 2018-04-29 (annotated)
- Committer:
- colson
- Date:
- Sun Apr 29 01:04:11 2018 +0000
- Revision:
- 5:5b86521e418c
- Parent:
- 4:62c590826ddb
- Child:
- 6:421ece74143e
-Created the almost done search tree
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
colson | 0:4e10b6c94be9 | 1 | #include "mbed.h" |
colson | 4:62c590826ddb | 2 | #include "Header_file.h" |
colson | 4:62c590826ddb | 3 | #include <iostream> |
colson | 4:62c590826ddb | 4 | #include <string> |
colson | 4:62c590826ddb | 5 | |
colson | 0:4e10b6c94be9 | 6 | |
colson | 5:5b86521e418c | 7 | |
colson | 5:5b86521e418c | 8 | |
colson | 5:5b86521e418c | 9 | |
Jeco13 | 3:6e52b66c5a0c | 10 | //Part 1 |
Jeco13 | 3:6e52b66c5a0c | 11 | //Main takes in string text input from bluetooth module. Store in string variable |
Jeco13 | 3:6e52b66c5a0c | 12 | //call text_to_morse function on each character from input string variable |
Jeco13 | 3:6e52b66c5a0c | 13 | |
colson | 0:4e10b6c94be9 | 14 | int main() { |
colson | 4:62c590826ddb | 15 | |
colson | 5:5b86521e418c | 16 | //Creation of the binary search tree// |
colson | 5:5b86521e418c | 17 | //I need to insert 2,8,9,0,+ |
colson | 5:5b86521e418c | 18 | Tree * newRoot; |
colson | 5:5b86521e418c | 19 | newRoot->insertdot('e', newRoot); |
colson | 5:5b86521e418c | 20 | Tree * eNode = newRoot->dot; |
colson | 5:5b86521e418c | 21 | eNode->insertdash('a', eNode); |
colson | 5:5b86521e418c | 22 | eNode->insertdot('i', eNode); |
colson | 5:5b86521e418c | 23 | Tree * iNode = eNode->dot; |
colson | 5:5b86521e418c | 24 | iNode->insertdash('u',iNode); |
colson | 5:5b86521e418c | 25 | iNode->insertdot('s',iNode); |
colson | 5:5b86521e418c | 26 | Tree * sNode = iNode->dot; |
colson | 5:5b86521e418c | 27 | sNode->insertdash('v',sNode); |
colson | 5:5b86521e418c | 28 | sNode->insertdot('h',sNode); |
colson | 5:5b86521e418c | 29 | Tree * hNode = sNode->dot; |
colson | 5:5b86521e418c | 30 | hNode->insertdash('4',hNode); |
colson | 5:5b86521e418c | 31 | hNode->insertdot('5',hNode); |
colson | 5:5b86521e418c | 32 | Tree * vNode = sNode->dash; |
colson | 5:5b86521e418c | 33 | vNode->insertdash('3',vNode); |
colson | 5:5b86521e418c | 34 | Tree * uNode = iNode->dash; |
colson | 5:5b86521e418c | 35 | uNode->insertdot('f',uNode); |
colson | 5:5b86521e418c | 36 | Tree * aNode = eNode->dash; |
colson | 5:5b86521e418c | 37 | aNode->insertdot('r',aNode); |
colson | 5:5b86521e418c | 38 | aNode->insertdash('w',aNode); |
colson | 5:5b86521e418c | 39 | Tree * rNode = aNode->dot; |
colson | 5:5b86521e418c | 40 | rNode->insertdot('l',rNode); |
colson | 5:5b86521e418c | 41 | Tree * wNode = aNode->dash; |
colson | 5:5b86521e418c | 42 | wNode->insertdot('p',wNode); |
colson | 5:5b86521e418c | 43 | wNode->insertdash('j',wNode); |
colson | 5:5b86521e418c | 44 | Tree * jNode = wNode->dash; |
colson | 5:5b86521e418c | 45 | jNode->insertdash('1',jNode); |
colson | 5:5b86521e418c | 46 | newRoot->insertdash('t',newRoot); |
colson | 5:5b86521e418c | 47 | Tree * tNode = newRoot->dash; |
colson | 5:5b86521e418c | 48 | tNode->insertdot('n',tNode); |
colson | 5:5b86521e418c | 49 | tNode->insertdash('m',tNode); |
colson | 5:5b86521e418c | 50 | Tree * nNode = tNode->dash; |
colson | 5:5b86521e418c | 51 | nNode->insertdot('d',nNode); |
colson | 5:5b86521e418c | 52 | nNode->insertdash('k',nNode); |
colson | 5:5b86521e418c | 53 | Tree * dNode = nNode->dot; |
colson | 5:5b86521e418c | 54 | dNode->insertdot('b',dNode); |
colson | 5:5b86521e418c | 55 | dNode->insertdash('x',dNode); |
colson | 5:5b86521e418c | 56 | Tree * bNode = dNode->dot; |
colson | 5:5b86521e418c | 57 | bNode->insertdot('6',bNode); |
colson | 5:5b86521e418c | 58 | bNode->insertdash('=',bNode); |
colson | 5:5b86521e418c | 59 | Tree * xNode = dNode->dash; |
colson | 5:5b86521e418c | 60 | xNode->insertdot('/',xNode); |
colson | 5:5b86521e418c | 61 | Tree * kNode = nNode->dash; |
colson | 5:5b86521e418c | 62 | kNode->insertdot('c',kNode); |
colson | 5:5b86521e418c | 63 | kNode->insertdash('y',kNode); |
colson | 5:5b86521e418c | 64 | Tree * mNode = tNode->dash; |
colson | 5:5b86521e418c | 65 | mNode->insertdot('g',mNode); |
colson | 5:5b86521e418c | 66 | mNode->insertdash('o',mNode); |
colson | 5:5b86521e418c | 67 | Tree * gNode = mNode->dot; |
colson | 5:5b86521e418c | 68 | gNode->insertdot('z',gNode); |
colson | 5:5b86521e418c | 69 | gNode->insertdash('q',gNode); |
colson | 5:5b86521e418c | 70 | Tree * zNode = gNode->dot; |
colson | 5:5b86521e418c | 71 | zNode->insertdot('7',zNode); |
colson | 5:5b86521e418c | 72 | |
colson | 4:62c590826ddb | 73 | string newString = "YYZ"; |
colson | 4:62c590826ddb | 74 | |
colson | 4:62c590826ddb | 75 | for (int i = 0; i < newString.length(); i++){ |
colson | 4:62c590826ddb | 76 | Text_to_morse(newString[i]); |
colson | 4:62c590826ddb | 77 | } |
colson | 4:62c590826ddb | 78 | |
colson | 4:62c590826ddb | 79 | char schar = 's'; |
colson | 4:62c590826ddb | 80 | char ochar = 'o'; |
colson | 0:4e10b6c94be9 | 81 | while(1) { |
colson | 4:62c590826ddb | 82 | uLCD.printf("do this\n"); |
colson | 4:62c590826ddb | 83 | Text_to_morse(schar); |
colson | 4:62c590826ddb | 84 | Text_to_morse(ochar); |
colson | 4:62c590826ddb | 85 | Text_to_morse(schar); |
colson | 4:62c590826ddb | 86 | wait(0.5); |
colson | 0:4e10b6c94be9 | 87 | } |
colson | 0:4e10b6c94be9 | 88 | } |