-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHelloMorseKeyboard.ino
50 lines (38 loc) · 1.63 KB
/
HelloMorseKeyboard.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*********************************************************************
This is an example for our nRF52 based Bluefruit LE modules
Pick one up today in the adafruit shop!
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
MIT license, check LICENSE for more information
All text above, and the splash screen below must be included in
any redistribution
Arduino Classes built using tutorial from adafruit: https://learn.adafruit.com/multi-tasking-the-arduino-part-1/a-classy-solution
Built with NottLimited for the GBoard Morse Keyboard
*********************************************************************/
int speedTyper = 300;
int speedSense = 2;
#include "customKeyboard.h"
//KeyboardKey varName (pin, primary ascii character, alternate ascii character, pressSpeed)
//ModifierKey varName (pin)
KeyboardKey periodKey(A0, 46, 120, speedTyper);
KeyboardKey hyphonKey(A1, 45, 121, speedTyper);
ModifierKey shiftKey(11);
void setup()
{
Serial.begin(115200);
Serial.println("HelloMorse BLE Keyboard");
Serial.println("--------------------------------\n");
Serial.println();
blueToothSetup();
}
void loop()
{
boolean shiftValue = shiftKey.Check();
speedTyper = analogRead(A2)/speedSense;
Serial.println(speedTyper);
periodKey.Press(shiftValue);
hyphonKey.Press(shiftValue);
// Request CPU to enter low-power mode until an event/interrupt occurs
waitForEvent();
}