-
• #2
Here part of the code with input/output example:
// touchKeyPadCalc2.js // (c)20181004_aO var kvs = "789CA456*/123+-00.==" // key values grid linear , tkp = new (require("TouchKeyPad"))( 0,141,24,103,5,4,kvs) // grid area, cols, rows , trd = new (require("TouchRD"))(B1,A5,A6,A7 ,function(x,y,t) { if (!t.t) // on un-touch: console.log(t.x,t.y,tkp.key(t.x,t.y),tkp.k,tkp.r,tkp.c); } ,require("TSRD26_142x104_cfg") );
The actual calculator is still on the list (suggestions are welcome) as well as attaching any kind of display. Output of input shows in console so far (: - Touching
8 2 . 5 x 3 =
produces this output (formatted and 'headed' posthume for legibility):` touched lup lin -grid- @ key key row col x y val idx idx idx --- --- --- --- --- --- 38 36 8 1 0 1 39 76 2 11 2 1 64 100 . 17 3 2 40 58 5 6 1 1 96 57 * 8 1 3 69 75 3 12 2 2 108 96 = 18 3 3 `
PS: Configured screen resolution is 142 W x 104 H spots (pixels), 0/0 is at left (x) top (y). Reasons for chosen resolution will be subject of another conversation.
...more to come...
-
• #3
Wow, I like that touch screen
What about this one? Is it similar to the one you use ?
-
• #4
Yes, I got mine from https://www.buydisplay.com/ - https://www.ebay.com/usr/buydisplay - directly - the shop(s) of the manufacturer EastRising Technology Co., Ltd. I guess, because the manufacturer Web site has no other indication. I buy always 2+, because they are somewhat fragile... broke my first when 'gently pushing' it into its location in 3d printed frame,... the gently was obviously not so gentle and a corner broke off... small, but of course exactly the one with the trace going around the corner opposite of the film connector, so I lost the Upper (in portrait) feed and sense line...
buydisplay is the source of (almost) all my displays, since I do not need the fruity, access easing surroundings (from adaFruit... I though admit that my first add-ons when getting started with Original Espruino board came from adafruit: display w/ resistive touchscreen (no touch screen controller), wifi CC3000 board, and possibly M6 uBlox GPS).
-
• #5
Looks great! Do you have links to your
touchRD
andtouchKey
modules? -
• #6
Getting the modules ready.
-
• #7
Modules are now on https://www.espruino.com/modules:
- TouchRD - Resistive Touchscreen Directly connected to Espruino
- Documentation - TouchRD - espruino.com/TouchRD
- Code - [TouchRD - ]espruino.com/modules/TouchRD.js](https://www.espruino.com/modules/TouchRD.js)
- Documentation - TouchRD - espruino.com/TouchRD
- TouchKeyPad - Mapping touch position in grid to a key value:
- Documentation - TouchKeyPad - espruino.com/TouchKeyPad
- Code - TouchKeyPadRD - espruino.com/modules/TouchKeyPad.js ]
- Documentation - TouchKeyPad - espruino.com/TouchKeyPad
TouchRD Documentation includes generic code for calibration for Portrait and Landscape use.
The configuration(s) as used in post #1 were created with the generic calibration code and then copied into the modules folder of the sandbox in the Espruino IDE:
// TSRD26_104x132_cfg.js (c) 20181003_allObjects // BuyDisplay.com 2.6" Resistive Touch Screen // Portrait configuration 104 W x 142 H // for TouchRD.js module exports = { X: 104 , Y: 142 , xt: 0.1117 , yt: 0.0854 , xc: 0.5067 , yc: 0.4876 , xd: 0.00736 , yd: 0.00553 };
// TSRD26_142x104_cfg.js - 20181003_allObjects // BuyDisplay.com 2.6" Resistive Touch Screen // Landscape configuration 142 W x 104 H // for TouchRD.js module exports = { X: 142 , Y: 104 , xm: 5 , ym: 5 , xt: 0.0822 , yt: 0.0966 , xc: 0.4694 , yc: 0.4960 , xd: 0.00534 , yd: 0.00744 };
- TouchRD - Resistive Touchscreen Directly connected to Espruino
A hybrid of old and new technology: A resistive touch screen over a sketched / printed 'keyboard' layout provides flexible input options. Getting rid of physical buttons and have unlimited entry options - that's what this is all about.
Here is my universal Espruino (PICO) keyboard. A few modules including a configuration module make a simple calculator entry.
2 Attachments