A light weight Morse code library to be used as a method of Communication along adaptive switches in open-source Assistive Technology projects.
This is a light weight morse library based on morse2go project with addition of direct keyboard and mouse support.
Morse code | Result |
---|---|
.- | 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 |
.---- | 1 |
..--- | 2 |
...-- | 3 |
....- | 4 |
..... | 5 |
-.... | 6 |
--... | 7 |
---.. | 8 |
----. | 9 |
----- | 0 |
----.. | \ |
....-- | / |
.--... | [ |
-..--- | ] |
--..-- | < |
..--.. | > |
---... | ( |
...--- | ) |
--..- | } |
..--. | { |
.----- | . |
-..... | , |
----.- | _ |
....-. | | |
-.---- | ? |
.-.... | ! |
-....- | ; |
.----. | : |
.---. | - |
..---- | $ |
...-.- | % |
...--. | " |
---..- | @ |
..-... | ' |
--.--- | ` |
-...-- | ^ |
---.-- | ~ |
..---. | # |
.---.. | & |
-...- | + |
---.- | = |
-..-- | * |
..-- | Space |
.-.- | Enter |
-- | Backspace |
--...- | Shift |
-.-. | Ctrl |
--.-- | Alt |
.-..- | ArrowUp |
.--.. | ArrowDown |
.-.-.. | ArrowLeft |
.-.-. | ArrowRight |
.....- | PgUp |
...-.. | PgDown |
....... | Home |
...-... | End |
---...- | NumLock |
--.-.. | ScrollLock |
-----. | CapsLock |
--.... | ESC |
-.-.. | Insert |
-.--.. | Delete |
--.--. | PrtScn |
Morse code | Result |
---|---|
- | Move Up |
-- | Move Down |
.. | Move Left |
... | Move Right |
.- | Left Click |
.-- | Right Click |
..- | Double Left Click |
..-- | Double Right Click |
-. | Left Click & Hold/Release |
-.. | Right Click & Hold/Release |
-
Download and extract this repository as EasyMorse under Arduino libraries subdirectory.
-
Include EasyMorse class in your sketch
#include "EasyMorse.h"
- Initialize EasyMorse class
EasyMorse morse;
- Initialize time variables for morse code
unsigned MS_MIN_DD = 50;
unsigned MS_MAX_DD =5000;
unsigned MS_END =5000;
unsigned MS_CL =5000;
- Clear morse stack before each usage (Each dot or dash push)
morse.clear();
- Push Dot (1) or Dash (2) to the stack
morse.push(1);
morse.push(2);
- Output the character using Keyboard library
Keyboard.write(morse.getCharAscii());
- Output the mouse action using mouse library
int* mouseAct;
mouseAct=morse.getMouse();
Mouse.press((int)mouseAct[0]);
Mouse.move((int)mouseAct[1],(int)mouseAct[2], 0);
Method | Return Type | Explanation |
---|---|---|
pointer | int | Pointer to top of the stack |
dotDash[MAXDD] | int | Stack of dot and dashes |
clear() | void | Clear the stack |
push(int) | void | Push a dot or dash to the stack |
pop() | void | Pop last dot or dash from the stack |
getCharNum() | long | Get number value of character. Example: .- = 12 |
getChar() | char | Get the resulting character |
getCharAscii() | int | Get the resulting character |
getMouse() | int* | Get the resulting mouse action |
Copyright (c) 2019 Milador
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.