From b5677826fd66b90a5cff721b7ea90eba7df5feb3 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Tue, 12 Nov 2019 17:55:59 +0000 Subject: [PATCH] random code to allow you to type using binary search --- testing/binary-keyboard.js | 50 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 testing/binary-keyboard.js diff --git a/testing/binary-keyboard.js b/testing/binary-keyboard.js new file mode 100644 index 000000000..3b68179a4 --- /dev/null +++ b/testing/binary-keyboard.js @@ -0,0 +1,50 @@ +/* +Binary search keyboard for typing with +the touchscreen +*/ + +function showChars(x,chars) { + var lines = Math.round(Math.sqrt(chars.length)*2); + g.setFontAlign(0,0); + var sy = Math.round(200/lines); + var sx = sy; + g.setFont("Vector", sy-2); + var y = (240 - lines*sy); + var last = 0; + for (var i=0;i { + clearWatch(); + show(charl,callback); + }, BTN4); + setWatch(() => { + clearWatch(); + show(charr,callback); + }, BTN5); +} + +function getCharacter() { + return new Promise(resolve => { + show("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",resolve); + }); +} + +getCharacter().then(print) \ No newline at end of file