A light weight Morse code library for Bluefruit bluetooth modules 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 | Key/Character | Modifier |
---|---|---|
.- | 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 | |
.-.- | Enter | |
..-.. | ESC | |
-- | Backspace | |
---..-. | Tab | |
..-- | Space | |
.---. | - | |
---.- | = | |
.--... | [ | |
-..--- | ] | |
----.. | \ | |
..---. | # | |
-....- | ; | |
..-... | ' | |
--.--- | ` | |
-..... | , | |
.----- | . | |
....-- | / | |
-----. | CapsLock | |
--.---- | F1 | |
--..--- | F2 | |
--...-- | F3 | |
--....- | F4 | |
--..... | F5 | |
---.... | F6 | |
----... | F7 | |
-----.. | F8 | |
------. | F9 | |
------- | F10 | |
.------ | F11 | |
..----- | F12 | |
--.--. | PrtScn | |
--.-.. | ScrollLock | |
.-..-. | Pause | |
-.-.. | Insert | |
....... | Home | |
.....- | PgUp | |
-.--.. | Delete | |
...-... | End | |
...-.. | PgDown | |
.-.-. | Arrow Right | |
.-.-.. | Arrow Left | |
.--.. | Arrow Down | |
.-..- | Arrow Up | |
---...- | NumLock | |
-..-- | * | |
-...- | + | |
-.-. | Ctrl | Yes (0x01) |
--...- | Shift | Yes (0x02) |
--.-- | Alt | Yes (0x04) |
.-.... | ! | Shift |
---..- | @ | Shift |
..---- | $ | Shift |
...-.- | % | Shift |
-...-- | ^ | Shift |
.---.. | & | Shift |
---... | ( | Shift |
...--- | ) | Shift |
----.- | _ | Shift |
..--. | { | Shift |
--..- | } | Shift |
....-. | | | Shift |
.----. | : | Shift |
...--. | \ | Shift |
---.-- | ~ | Shift |
--..-- | < | Shift |
..--.. | > | Shift |
-.---- | ? | Shift |
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.
-
Download and Install Bluefruit Arduino library according to the Adafruit instructions:
https://learn.adafruit.com/adafruit-feather-32u4-bluefruit-le/installing-ble-library
- Include EasyMorseBlue class in your sketch for using morse functions
#include "EasyMorseBlue.h"
- Include EasyMorseBlueHid class in your sketch for using keyboard and mouse action functions
#include "EasyMorseBlueHid.h"
- Initialize EasyMorse morse class
EasyMorseBlue morse;
- Initialize Bluefruit HID Keyboard/Mouse if you are using EasyMorseBlueBlue class
initializeHidMorse();
- 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) (EasyMorseBlue)
morse.clear();
- Push Dot (1) or Dash (2) to the stack: (EasyMorseBlue)
morse.push(1);
morse.push(2);
- Get the output character: (EasyMorseBlue)
morse.getChar();
- Get the Bluefruit output character key code: (EasyMorseBlue)
morse.getBlueChar();
- Get the Bluefruit output modifier key code: (EasyMorseBlue)
morse.getBlueModifier();
- Get the mouse action: (EasyMorseBlue)
int* mouseAct;
mouseAct=morse.getMouse();
- Enter character key: (EasyMorseBlueHid)
enterKeyboardChar(char charachter);
- Enter character and modifier key code: (EasyMorseBlueHid)
enterKeyboard(uint8_t modifierCode, uint8_t charachterCode);
- Release keyboard action: (EasyMorseBlueHid)
clearKeyboard();
- Enter mouse action: (EasyMorseBlueHid)
enterMouse(int button,int xValue,int yValue);
- Release mouse action: (EasyMorseBlueHid)
clearMouse();
Method | Return Type | Explanation | Class |
---|---|---|---|
pointer | int | Pointer to top of the stack | EasyMorseBlue |
dotDash[MAXDD] | int | Stack of dot and dashes | EasyMorseBlue |
clear() | void | Clear the stack | EasyMorseBlue |
push(int) | void | Push a dot or dash to the stack | EasyMorseBlue |
pop() | void | Pop last dot or dash from the stack | EasyMorseBlue |
getCharNum() | long | Get number value of character. Example: .- = 12 | EasyMorseBlue |
getChar() | char | Get the resulting character | EasyMorseBlue |
getBlueChar() | int | Get the resulting Bluefruit character code | EasyMorseBlue |
getBlueModifier() | int | Get the resulting Bluefruit modifier code | EasyMorseBlue |
getMouse() | int* | Get the resulting mouse action | EasyMorseBlue |
initializeHidMorse(String name) | void | Initialize HID Device function | EasyMorseBlueHid |
enterMouse(int button,int xValue,int yValue) | void | Mouse action function | EasyMorseBlueHid |
clearMouse() | void | Release Mouse action function | EasyMorseBlueHid |
enterKeyboard(uint8_t modifierCode, uint8_t charachterCode) | void | Enter Keyboard charachter and modifier function | EasyMorseBlueHid |
enterKeyboardChar(char charachter) | void | Enter Keyboard charachter function | EasyMorseBlueHid |
clearKeyboard() | void | Release Keyboard charachter function | EasyMorseBlueHid |
Copyright (c) 2020 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.