Vim movement keys to select characters in a browser and type.

Dependencies:   DebounceIn USBDevice mbed

Chrome App: https://github.com/cle1994/browser-serialport

main.cpp

Committer:
christianle
Date:
2015-09-13
Revision:
0:808977178c2d

File content as of revision 0:808977178c2d:

#include "mbed.h"
#include "DebounceIn.h"

DebounceIn up(D13);
DebounceIn down(D12);
DebounceIn space(D11);
DebounceIn enter(D10);
DebounceIn h(D9);
DebounceIn j(D8);
DebounceIn k(D7);
DebounceIn l(D6);

Serial pc(USBTX, USBRX);
 
int main() {
    pc.printf("Welcome");
    up.mode(PullUp);
    down.mode(PullUp);
    space.mode(PullUp);
    enter.mode(PullUp);
    h.mode(PullUp);
    j.mode(PullUp);
    k.mode(PullUp);
    l.mode(PullUp);
 
    while(1) {
        if (!up) {
            pc.printf("u");
        }
        if (!down) {
            pc.printf("d");
        }
        if (!space) {
            pc.printf("s");
        }
        if (!enter) {
            pc.printf("e");
        }
        if (!h) {
            pc.printf("h");
        }
        if (!j) {
            pc.printf("j");
        }
        if (!k) {
            pc.printf("k");
        }
        if (!l) {
            pc.printf("l");
        }
        wait(0.25);
    }
}