Accidentally published before and don't have admin privileges to delete the repository... This is a keyboard that uses chording. It requires five fingers on one hand (designed for left) along with one right finger. It uses binary representation with five buttons to cover 29 unique gestures (27 letters of the alphabet, space bar, and backspace). I made this so that I could manipulate some parameter with my hand while being able to still manipulate other equipment (such as knobs on a distortion box).

Dependencies:   USBDevice mbed

Fork of USBKeyboard_HelloWorld by Samuel Mokrani

Files at this revision

API Documentation at this revision

Comitter:
nonchalamment
Date:
Thu Jun 22 18:43:13 2017 +0000
Parent:
6:17871da2a7e4
Commit message:
:)

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 17871da2a7e4 -r cc377cca1e3b main.cpp
--- a/main.cpp	Fri Mar 01 13:23:58 2013 +0000
+++ b/main.cpp	Thu Jun 22 18:43:13 2017 +0000
@@ -1,21 +1,250 @@
 #include "mbed.h"
 #include "USBKeyboard.h"
- 
-//LED1: NUM_LOCK
-//LED2: CAPS_LOCK
-//LED3: SCROLL_LOCK
-BusOut leds(LED1, LED2, LED3);
- 
-//USBKeyboard
+
+DigitalOut blue(LED1);
+DigitalOut green(LED2);
+DigitalOut red(LED3);
+
+DigitalOut salami(D11);
+DigitalOut ham(D12);
+DigitalOut sausage(D13);
+
+DigitalIn a(D2);
+DigitalIn b(D3);
+DigitalIn c(D6);
+
+DigitalIn d(D7);
+DigitalIn e(D8);
+DigitalIn z(D9);
+
 USBKeyboard keyboard;
- 
-int main(void) {
-    while (1) {
-        keyboard.mediaControl(KEY_VOLUME_DOWN);
-        keyboard.printf("Hello World from Mbed\r\n");
-        keyboard.keyCode('s', KEY_CTRL);
-        keyboard.keyCode(KEY_CAPS_LOCK);
-        wait(1);
-        leds = keyboard.lockStatus();
+Timer timer;
+
+int main() {
+    a.mode(PullUp);
+    b.mode(PullUp);
+    c.mode(PullUp);
+    d.mode(PullUp);
+    e.mode(PullUp);
+    z.mode(PullUp);
+    blue = 1;
+    green = 1;
+    red = 1;
+ //   uint8_t p_bus = 0;
+          
+    while(1) {
+        blue = -(a + d);
+        green = -(b + e);
+        red =  -(c + z);
+        salami = !d;
+        ham = !e;
+        sausage = z;
+        
+        if (a != 0 && b == 0 && c == 0 && d == 0 && e == 0 && z == 0){
+            wait(0.1);
+            if (a != 0 && b == 0 && c == 0 && d == 0 && e == 0 && z == 0){
+                keyboard.keyCode(13);
+                wait(0.01);
+                }
+            }
+        if (a == 0 && b == 0 && c == 0 && d == 0 && e == 0 && z == 0){
+            wait(0.1);
+            if (a == 0 && b == 0 && c == 0 && d == 0 && e == 0 && z == 0){
+                keyboard.keyCode(8);
+                wait(0.01);
+                }
+            }
+        if (a != 0 && b != 0 && c == 0 && d == 0 && e != 0 && z == 0){
+            wait(0.1);
+            if (a != 0 && b != 0 && c == 0 && d == 0 && e != 0 && z == 0){
+                keyboard.keyCode('k');
+                wait(0.01);
+                }
+            }
+        if (a != 0 && b != 0 && c == 0 && d != 0 && e == 0 && z == 0){
+            wait(0.1);
+            if (a != 0 && b != 0 && c == 0 && d != 0 && e == 0 && z == 0){
+                keyboard.keyCode('l');
+                wait(0.01);
+                }
+            }
+        if (a != 0 && b != 0 && c != 0 && d == 0 && e == 0 && z == 0){
+            wait(0.1);
+            if (a != 0 && b != 0 && c != 0 && d == 0 && e == 0 && z == 0){
+                keyboard.keyCode('m');
+                wait(0.01);
+                }
+            }
+        if (a == 0 && b == 0 && c == 0 && d != 0 && e != 0 && z == 0){
+            wait(0.1);
+            if (a == 0 && b == 0 && c == 0 && d != 0 && e != 0 && z == 0){
+                keyboard.keyCode('n');
+                wait(0.01);
+                }
+            }       
+        if (a == 0 && b == 0 && c != 0 && d == 0 && e != 0 && z == 0){
+            wait(0.1);
+            if (a == 0 && b == 0 && c != 0 && d == 0 && e != 0 && z == 0){
+                keyboard.keyCode('p');
+                wait(0.01);
+                }
+            }
+        if (a == 0 && b == 0 && c != 0 && d != 0 && e == 0 && z == 0){
+            wait(0.1);
+            if (a == 0 && b == 0 && c != 0 && d != 0 && e == 0 && z == 0){
+                keyboard.keyCode('q');
+                wait(0.01);
+                }
+            }
+        if (a == 0 && b != 0 && c == 0 && d == 0 && e != 0 && z == 0){
+            wait(0.1);
+            if (a == 0 && b != 0 && c == 0 && d == 0 && e != 0 && z == 0){
+                keyboard.keyCode('r');
+                wait(0.01);
+                }
+            }
+        if (a == 0 && b != 0 && c == 0 && d != 0 && e == 0 && z == 0){
+            wait(0.1);
+            if (a == 0 && b != 0 && c == 0 && d != 0 && e == 0 && z == 0){
+                keyboard.keyCode('s');
+                wait(0.01);
+                }
+            }
+        if (a == 0 && b != 0 && c != 0 && d == 0 && e == 0 && z == 0){
+            wait(0.1);
+            if (a == 0 && b != 0 && c != 0 && d == 0 && e == 0 && z == 0){
+                keyboard.keyCode('t');
+                wait(0.01);
+                }
+            }
+        if (a != 0 && b == 0 && c == 0 && d == 0 && e != 0 && z == 0){
+            wait(0.1);
+            if (a != 0 && b == 0 && c == 0 && d == 0 && e != 0 && z == 0){
+                keyboard.keyCode('v');
+                wait(0.01);
+                }
+            }
+        if (a != 0 && b == 0 && c == 0 && d != 0 && e == 0 && z == 0){
+            wait(0.1);
+            if (a != 0 && b == 0 && c == 0 && d != 0 && e == 0 && z == 0){
+                keyboard.keyCode('w');
+                wait(0.01);
+                }
+            }
+        if (a != 0 && b == 0 && c != 0 && d == 0 && e == 0 && z == 0){
+            wait(0.1);
+            if (a != 0 && b == 0 && c != 0 && d == 0 && e == 0 && z == 0){
+                keyboard.keyCode('x');
+                wait(0.01);
+                }
+            }
+        if (a != 0 && b != 0 && c == 0 && d == 0 && e == 0 && z == 0){
+            wait(0.1);
+            if (a != 0 && b != 0 && c == 0 && d == 0 && e == 0 && z == 0){
+                keyboard.keyCode('y');
+                wait(0.01);
+                }
+            }
+        if (a == 0 && b == 0 && c == 0 && d == 0 && e != 0 && z == 0){
+            wait(0.1);
+            if (a == 0 && b == 0 && c == 0 && d == 0 && e != 0 && z == 0){
+                keyboard.keyCode('z');
+                wait(0.01);
+                }
+            }
+        if(a != 0 && b != 0 && c != 0 && d != 0 && e != 0 && z == 0){
+            wait(0.1);
+            if (a != 0 && b != 0 && c != 0 && d != 0 && e != 0 && z == 0){
+                keyboard.keyCode(32);
+                wait(0.01);
+                }
+            }    
+        if(a == 0 && z == 0 && b != 0 && c != 0 && d != 0 && e != 0){
+            wait(0.1);
+            if(a == 0 && z == 0 && b != 0 && c != 0 && d != 0 && e != 0){
+               keyboard.keyCode('a');
+               wait(0.01);
+               }
+            }
+        if(a == 0 && b == 0 && z == 0 && c != 0 && d != 0 && e != 0){
+            wait(0.1);
+            if (a == 0 && b == 0 && z == 0 && c != 0 && d != 0 && e != 0){
+                keyboard.keyCode('e');
+                wait(0.01);
+                }
+            }
+        if(a == 0 && c == 0 && z == 0 && b != 0 && d != 0 && e != 0){
+            wait(0.1);
+            if (a == 0 && c == 0 && z == 0 && b != 0 && d != 0 && e != 0){
+                keyboard.keyCode('i');
+                wait(0.01);
+                }
+            }
+        if(a == 0 && e == 0 && z == 0 && b != 0 && c != 0 && d != 0){
+            wait(0.1);
+            if (a == 0 && e == 0 && z == 0 && b != 0 && c != 0 && d != 0){
+                keyboard.keyCode('u');
+                wait(0.01);
+                }
+            }
+        if(a == 0 && d == 0 && z == 0 && b != 0 && c != 0 && e != 0){
+            wait(0.1);
+            if (a == 0 && d == 0 && z == 0 && b != 0 && c != 0 && e != 0){
+                keyboard.keyCode('o');
+                wait(0.01);
+                }
+            }
+        if(a != 0 && b == 0 && c != 0 && d != 0 && e != 0 && z == 0){
+            wait (0.1);
+            if (a != 0 && b == 0 && c != 0 && d != 0 && e != 0 && z == 0){
+                keyboard.keyCode('b');
+                wait(0.01);
+                }
+            }
+        if(a !=0 && b != 0 && c == 0 && d != 0 && e != 0 && z == 0){
+            wait(0.1);
+            if (a != 0 && b != 0 && c == 0 && d != 0 && e != 0 && z == 0){
+                keyboard.keyCode('c');
+                wait(0.01);
+                }
+            }
+        if(a != 0 && b != 0 && c != 0 && d == 0 && e != 0 && z == 0){
+            wait(0.1);
+            if (a != 0 && b != 0 && c != 0 && d == 0 && e != 0 && z == 0){
+                keyboard.keyCode('d');
+                wait(0.01);
+                }
+            }
+        if(a != 0 && b != 0 && c != 0 && d != 0 && e == 0 && z == 0){
+            wait(0.1);
+            if (a != 0 && b != 0 && c != 0 && d != 0 && e == 0 && z == 0){
+                keyboard.keyCode('f');
+                wait(0.01);
+                }
+            }
+        if(a != 0 && b == 0 && c == 0 && d != 0 && e != 0 && z == 0){
+            wait(0.1);
+            if (a != 0 && b == 0 && c == 0 && d != 0 && e != 0 && z == 0){
+                keyboard.keyCode('g');
+                wait(0.01);
+                }
+            }
+        if(a != 0 && b == 0 && c != 0 && d == 0 && e != 0 && z == 0){
+            wait(0.1);
+            if (a != 0 && b == 0 && c != 0 && d == 0 && e != 0 && z == 0){
+                keyboard.keyCode('h');
+                wait(0.01);
+            }
+        }
+        if (a != 0 && b == 0 && c != 0 && d != 0 && e == 0 && z == 0){
+            wait(0.1);
+            if (a != 0 && b == 0 && c != 0 && d != 0 && e == 0 && z == 0){
+                keyboard.keyCode('j');
+                wait(0.01);
+            }
+                  
+    
+    
+        }
     }
 }
\ No newline at end of file