Robin - I did actually display the letters on the screen to show which button did which. I wrote a prototype for this using a web browser a while ago - on the computer it did work OK, but on the Pixl I found it easier just to have a paper reference and think of each letter as a shape. Annoyingly I deleted the Pixl version which did draw to the screen!
If you're interested in trying then I think this code should work as a base, but I just wrote it and it might have bugs (e.g. I think it will show the ! unused marker). Changing the console.log to g.drawString in the appropriate place, and calling the showLabels(state) function after key up and key down should do the trick I think.
// Traverse the tree to show characters reachable from a certain state
// as a string
function reachablefrom(state) {
if (state=='?') return ""; // End recursion
return reachablefrom(states[state][0])+
reachablefrom(states[state][1])+
reachablefrom(states[state][2])+
reachablefrom(states[state][3]);
}
// Show characters available from each button
function showLabels(state) {
console.log("KEY1",reachablefrom(states[state][0]));
console.log("KEY2",reachablefrom(states[state][1]));
console.log("KEY3",reachablefrom(states[state][2]));
console.log("KEY4",reachablefrom(states[state][3]));
}
Gordon - I'm glad you're thinking the same as I am about the Puck making a tiny input device. Funnily enough that's why I bought it a while ago and am only just having time to play with it :-)
I'm actually wondering about some sort of finger movement detection sensor rather than buttons - It feels to me that 'writing out' the shapes by swiping a finger around might actually be quicker than pressing and holding buttons in sequence.
One option might be to use an optical mouse sensor - but they seem a bit harder to get hold of now (That's what I get for throwing out a hoard of old mice...note: never throw out old junk). The APDS-9960 sensor looks like it can do gestures from a distance, but I'm thinking more of touches - faster movements much closer to the device.
A capacitative sensor might work, but I'm not sure having 4 pads and just sensing a touch on each would work, as ideally it would be quite small and a fat finger might just smash all pads at once. I've got hold of an MPR121 board, which looks as though it can read the raw value of each sensor. Doing something clever with the raw values might allow movement detection - I will need to experiment.
Regarding the reconnection on the phone - I'll need to experiment more. I had a bit of a frustrating time when the Pixl stopped accepting any connections and I couldn't reconnect to debug it. I even put the Pixl in the microwave oven (with the oven off!) to see if it made a difference, as I got paranoid that somehow one of my neighbours was connecting to the UART service all the time! And shielded by the microwave there was no connection - so the problem wasn't the Pixl thinking it had a connection when it didn't. It turns out that my Mac was auto-connecting to it as soon as it advertised as an HID device and was staying connected even when the screen was closed (I thought if it was the Mac closing the screen would disconnect, so this sent me down a wild goose chase). Grr. So I will try the phone connection again with my Mac switched off - maybe it was working all along. I haven't yet investigated the bonding and PIN stuff however - I will do this also which might help.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Thanks for the positive feedback!
Robin - I did actually display the letters on the screen to show which button did which. I wrote a prototype for this using a web browser a while ago - on the computer it did work OK, but on the Pixl I found it easier just to have a paper reference and think of each letter as a shape. Annoyingly I deleted the Pixl version which did draw to the screen!
If you're interested in trying then I think this code should work as a base, but I just wrote it and it might have bugs (e.g. I think it will show the ! unused marker). Changing the console.log to g.drawString in the appropriate place, and calling the showLabels(state) function after key up and key down should do the trick I think.
Gordon - I'm glad you're thinking the same as I am about the Puck making a tiny input device. Funnily enough that's why I bought it a while ago and am only just having time to play with it :-)
I'm actually wondering about some sort of finger movement detection sensor rather than buttons - It feels to me that 'writing out' the shapes by swiping a finger around might actually be quicker than pressing and holding buttons in sequence.
One option might be to use an optical mouse sensor - but they seem a bit harder to get hold of now (That's what I get for throwing out a hoard of old mice...note: never throw out old junk). The APDS-9960 sensor looks like it can do gestures from a distance, but I'm thinking more of touches - faster movements much closer to the device.
A capacitative sensor might work, but I'm not sure having 4 pads and just sensing a touch on each would work, as ideally it would be quite small and a fat finger might just smash all pads at once. I've got hold of an MPR121 board, which looks as though it can read the raw value of each sensor. Doing something clever with the raw values might allow movement detection - I will need to experiment.
Regarding the reconnection on the phone - I'll need to experiment more. I had a bit of a frustrating time when the Pixl stopped accepting any connections and I couldn't reconnect to debug it. I even put the Pixl in the microwave oven (with the oven off!) to see if it made a difference, as I got paranoid that somehow one of my neighbours was connecting to the UART service all the time! And shielded by the microwave there was no connection - so the problem wasn't the Pixl thinking it had a connection when it didn't. It turns out that my Mac was auto-connecting to it as soon as it advertised as an HID device and was staying connected even when the screen was closed (I thought if it was the Mac closing the screen would disconnect, so this sent me down a wild goose chase). Grr. So I will try the phone connection again with my Mac switched off - maybe it was working all along. I haven't yet investigated the bonding and PIN stuff however - I will do this also which might help.