Skip to content

A bluetooth Morse code library for Adafruit Bluefruit Bluetooth boards which can be used as a method of communication in adaptive switch interfaces.

License

Notifications You must be signed in to change notification settings

milador/EasyMorseBlue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EasyMorseBlue

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 mapping ( Keyboard mode )

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 mapping ( Mouse mode )

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

Usage

  1. Download and extract this repository as EasyMorse under Arduino libraries subdirectory.

  2. Download and Install Bluefruit Arduino library according to the Adafruit instructions:

https://learn.adafruit.com/adafruit-feather-32u4-bluefruit-le/installing-ble-library

  1. Include EasyMorseBlue class in your sketch for using morse functions
#include "EasyMorseBlue.h"
  1. Include EasyMorseBlueHid class in your sketch for using keyboard and mouse action functions
#include "EasyMorseBlueHid.h"
  1. Initialize EasyMorse morse class
EasyMorseBlue morse;
  1. Initialize Bluefruit HID Keyboard/Mouse if you are using EasyMorseBlueBlue class
initializeHidMorse();
  1. Initialize time variables for morse code
unsigned MS_MIN_DD = 50;
unsigned MS_MAX_DD =5000;
unsigned MS_END =5000;
unsigned MS_CL =5000;
  1. Clear morse stack before each usage (Each dot or dash push) (EasyMorseBlue)
morse.clear();
  1. Push Dot (1) or Dash (2) to the stack: (EasyMorseBlue)
morse.push(1);
morse.push(2);
  1. Get the output character: (EasyMorseBlue)
morse.getChar(); 
  1. Get the Bluefruit output character key code: (EasyMorseBlue)
morse.getBlueChar(); 
  1. Get the Bluefruit output modifier key code: (EasyMorseBlue)
morse.getBlueModifier(); 
  1. Get the mouse action: (EasyMorseBlue)
int* mouseAct;
mouseAct=morse.getMouse();
  1. Enter character key: (EasyMorseBlueHid)
enterKeyboardChar(char charachter);
  1. Enter character and modifier key code: (EasyMorseBlueHid)
enterKeyboard(uint8_t modifierCode, uint8_t charachterCode);
  1. Release keyboard action: (EasyMorseBlueHid)
clearKeyboard();
  1. Enter mouse action: (EasyMorseBlueHid)
enterMouse(int button,int xValue,int yValue);
  1. Release mouse action: (EasyMorseBlueHid)
clearMouse();

Methods

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

License

MIT License

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.

MIT License

About

A bluetooth Morse code library for Adafruit Bluefruit Bluetooth boards which can be used as a method of communication in adaptive switch interfaces.

Topics

Resources

License

Stars

Watchers

Forks

Packages