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

Dependencies:   DebounceIn USBDevice mbed

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

Committer:
christianle
Date:
Sun Sep 13 04:26:53 2015 +0000
Revision:
0:808977178c2d
BrowserVim

Who changed what in which revision?

UserRevisionLine numberNew contents of line
christianle 0:808977178c2d 1 #include "mbed.h"
christianle 0:808977178c2d 2 #include "DebounceIn.h"
christianle 0:808977178c2d 3
christianle 0:808977178c2d 4 DebounceIn up(D13);
christianle 0:808977178c2d 5 DebounceIn down(D12);
christianle 0:808977178c2d 6 DebounceIn space(D11);
christianle 0:808977178c2d 7 DebounceIn enter(D10);
christianle 0:808977178c2d 8 DebounceIn h(D9);
christianle 0:808977178c2d 9 DebounceIn j(D8);
christianle 0:808977178c2d 10 DebounceIn k(D7);
christianle 0:808977178c2d 11 DebounceIn l(D6);
christianle 0:808977178c2d 12
christianle 0:808977178c2d 13 Serial pc(USBTX, USBRX);
christianle 0:808977178c2d 14
christianle 0:808977178c2d 15 int main() {
christianle 0:808977178c2d 16 pc.printf("Welcome");
christianle 0:808977178c2d 17 up.mode(PullUp);
christianle 0:808977178c2d 18 down.mode(PullUp);
christianle 0:808977178c2d 19 space.mode(PullUp);
christianle 0:808977178c2d 20 enter.mode(PullUp);
christianle 0:808977178c2d 21 h.mode(PullUp);
christianle 0:808977178c2d 22 j.mode(PullUp);
christianle 0:808977178c2d 23 k.mode(PullUp);
christianle 0:808977178c2d 24 l.mode(PullUp);
christianle 0:808977178c2d 25
christianle 0:808977178c2d 26 while(1) {
christianle 0:808977178c2d 27 if (!up) {
christianle 0:808977178c2d 28 pc.printf("u");
christianle 0:808977178c2d 29 }
christianle 0:808977178c2d 30 if (!down) {
christianle 0:808977178c2d 31 pc.printf("d");
christianle 0:808977178c2d 32 }
christianle 0:808977178c2d 33 if (!space) {
christianle 0:808977178c2d 34 pc.printf("s");
christianle 0:808977178c2d 35 }
christianle 0:808977178c2d 36 if (!enter) {
christianle 0:808977178c2d 37 pc.printf("e");
christianle 0:808977178c2d 38 }
christianle 0:808977178c2d 39 if (!h) {
christianle 0:808977178c2d 40 pc.printf("h");
christianle 0:808977178c2d 41 }
christianle 0:808977178c2d 42 if (!j) {
christianle 0:808977178c2d 43 pc.printf("j");
christianle 0:808977178c2d 44 }
christianle 0:808977178c2d 45 if (!k) {
christianle 0:808977178c2d 46 pc.printf("k");
christianle 0:808977178c2d 47 }
christianle 0:808977178c2d 48 if (!l) {
christianle 0:808977178c2d 49 pc.printf("l");
christianle 0:808977178c2d 50 }
christianle 0:808977178c2d 51 wait(0.25);
christianle 0:808977178c2d 52 }
christianle 0:808977178c2d 53 }