Skip to content

A simplified Morse code arduino library 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/EasyMorse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EasyMorse

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

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 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. Include EasyMorse class in your sketch

#include "EasyMorse.h"
  1. Initialize EasyMorse class
EasyMorse morse;
  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)
morse.clear();
  1. Push Dot (1) or Dash (2) to the stack
morse.push(1);
morse.push(2);
  1. Output the character using Keyboard library
Keyboard.write(morse.getCharAscii()); 
  1. 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);

Methods

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

License

MIT License

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.

MIT License

About

A simplified Morse code arduino library which can be used as a method of communication in adaptive switch interfaces.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages