-
Hehe, I'll need to check out
heatshrink.js
to make me feel better about my wasm-ing!Ah yeah, an irdb.js could be great! I've got a tiny bit of wrapper code which splits/regexes lines and parses csv files which could be a starting point.
The irdb.tk site is being discussed on https://github.com/probonopd/irdb/issues/28
It sounds like there's interest in getting it back online (and maybe migrating to GitHub pages), though sounds like they might be struggling with time. I'm sure they'd love to hear any offers of hosting or "upload to Puck.js" opportunities!
-
Thanks a lot @Robin, glad you like it!!
@Gordon, yep I built the MakeHex wasm - was my first time using WebAssembly; don't think it's the best example of it! It pulls directly from IRDB, so any updates should appear here too. I've been in touch with the IRBD maintainers about using this approach to rebuild irdb.tk (it's been down for the last few months).
Oh my, a configurator would be amazing. Especially being able to chain together commands - you could do all sorts of things.
Good shout on the Try It Now link - I'll add that to the readme.
Thanks for checking it out!
-
Project: https://benjaminbenben.com/puckmote
Source: https://github.com/benfoxall/puckmote
Video: https://photos.app.goo.gl/7MuC2SxdMbTUpC8g9I've been hacking on a page that allows you load IR codes for a tv/projector/etc, and send them on to your Puck.
- It's installable as a progressive web app, so you can "Save" a controller on your phone homescreen
- pronto codes are generated on the fly using a webassembly build of MakeHex
- Repeat presses are faster/cached because the IR codes can be quite large
Back story - I made a remote control for my TV last year, though I thought it could be interesting/handy to let you pick devices from a list.
- It's installable as a progressive web app, so you can "Save" a controller on your phone homescreen
-
Ah yep, a promise interface for the Puck.js library eval could be sweet - and I guess it would work alongside the callback option, so wouldn't break anything. Is that another thing that I could PR? I've never contributed code to Espruino, and I'd really like to.
I guess the slight difference with the wrapper is that I can run async tasks on the puck (like waiting for button presses/states), I'm not sure how I'd do that with Puck.eval.
Ah, UART.js seems where my PuckSocket thing is headed. I'll take more of a look. Have you done much with the streams api? It seems a slightly odd api, but might fit pretty well.
Ah, that function serialising is cool! The result reminds me a bit of comlink.
-
With the IDE, that's great! Thanks for the pointers, I'll have a dig and try and raise a PR.
upload
seems fine for my use case, I could just print "Hello from MicroChat" or something.TIL about the emulator - that's amazing! wow.
With the prompt & buttons. I've been playing with a (sketchy atm) host/puck rpc wrapper. It's pretty similar to
Puck.eval(…)
, but it lets you do async listeners and handles errors.It lets you write browser code like:
await rpc('new Promise(resolve => setWatch(() => resolve(), BTN))') console.log('Battery level: ' + await rpc('E.getBattery()')) try { await rpc('E.getButtery()') } catch(e) { // Error - getButtery is not defined }
I'm still playing around, but I'm hoping that it'll make it easier to spread code between a page & microcontroller. So for chat button prompt for "light-on: yes/no" could be in react/telegram/wherever.
The other option I explored was
puck = new PuckWorker('puck-script.js')
, which would feel like a web-worker, but be running on a puck. You get a nice pattern for messaging, andpuck-script.js
would be espruino-only code, which might make it easier for more complex usage. Though I guess it's a bit of a different usage to having longer-lived scripts running.Aw, his own rover sounds so much fun! (Perseverance is amazing 🤩).
Gonna check out your bookmarklet!
-
Thanks @Gordon!! (Hope all is good!)
Oh man, I do love a good emoji replacement. I'll have a think about that! 🤔
For something like the robot commands, I'm wondering if there's some approach like telegram bots where you could display buttons in the chat dialog. Though maybe your son might prefer typing it!
Ah great! I'll enable the flag and play with
navigator.bluetooth.getDevices
.With the IDE, is there a way to link to it and have it connect to a specified device? I'd love to add a button from this ui which is "open this device in the IDE". If that's not possible, is that something I could add a PR for?
Oooooo, slacking a puck could be amazing!!
-
-
Thanks! The UI style is from TailwindCSS, and there's some React code for managing the state of the app.
There's a persistent connection behind a chrome flag which I think would allow it persist when reloaded, but I've not looked into it yet.
The goal of the project is a bit odd (I wasn't sure if this was the best place to post it in fact). I started off making a remote control for my TV, then I liked the idea of locking to a device, so had a bit of a hack and ended up with this.
-
I've been playing around with building a chat ui for connecting to Espruino boards.
It's not quite ready, and it's broken in a few ways but I wanted to share it so that I don't disappear down a rabbit hole with it!
When you add a device and it's like a "contact", and then you can start a session which feels like a "chat". Currently I'm showing a terminal session in the ui, but I've got plans to make it more message based (I've got a pretty neat wrapper for rpc functions).
Just now I'm showing the device name, but I'm planning to make that editable so you can have "My Pink Neopixel Puck" and some notes about what you've got attached. Because it's url based, you can bookmark/link a particular device.
So far, the UX seems to work pretty well. It feels quite natural to browse devices without opening up the BLE dialog. And when you decide to connect, I'm able to limit the dialog so it only shows the device you're looking for. Reconnecting on reload feels pretty natural. It sounds like there's some device api in the pipeline that might make it even cleaner.
I'm thinking this UI might give a pretty good route for extending beyond repl interactions. You could have something like slack slash commands to perform more complex tasks.
With the implementation, I started with with puck.js library, though I ended up extracting bits of that into my own Socket class so that I could separate devices from creating sockets. It's a bit hairy at the moment, but seems like it's going to work okay.
-
Oh yeah, I remember chatting about that - it'd be brilliant!! I had a bit of a hack into configurable scripts with a countdown timer & LED blink. I also put together some ui sketches but I can't find them.
Oh wow, more devices with Web Serial would be awesome. And being able to read back data in a nice way would allow some really useful apps.
With the neopixel app suggestion - if it was a generic app loader, I'd wonder about adding a button to my espruino-pixels page which would be "load this pattern on a puck.js" (though maybe that's already possible with the ide? 🧐)
When I was thinking before, I was pretty focussed on PuckJS and the angle was "turn my puck into X", so I was thinking Countdown Timer, Music Remote Control, Blinking Light, etc. With different devices, and connected things there'd be a whole lot more!
I'd be up for contributing apps, though also let me know if I can help with design/build of the app loader - I'd love to be involved in that!
-
Hey Joost! (Thanks Gordon for pointing me here!)
This looks like a brilliant bit of kit - and making your own head unit sounds like an awesome project. I'd be really interested in hearing updates too.
I'm planning to make a tracker which would only check values every hour (I'm planning to capture bike usage over several months). Do the cumulative revolutions increase whilst you're not connected? If so, I'm definitely going to pick up one of these.
-
@Gordon cheers! I've put together a bit of a test page here https://benjaminbenben.com/espruino-pixels/ it's got a couple of examples from the docs, and the flood one I was using for my web-bluetooth lights. Hopefully it'll be useful for other people (would love to see a few more examples if anyone can contribute.)
If it's more useful to have it in a jsbin - I could do that too.
-
@Gordon WOAH. That's such awesome news - thanks so much for fixing that.
I'm heading out today, though I'm looking forward to giving it a try (I can stop telling people that the first light is intentional to show me that it's powered on!)
I'm not sure if I said, but I built a E.neopixel stub that lets you try out animations in a browser https://github.com/benfoxall/ador-puck-demo/blob/master/stub.html - I found it pretty useful for working out animations. It's a bit wrapped up in the mqtt stuff I was working on, but I could probably pull it out if useful.
-
@Gordon - oh, I may well have written that to the wrong one. Just went through it again and I'm upgraded to 1v92 fine. Thanks so much for your help!
-
Thanks @Gordon, Okay, I've re-flashed it with 1v91 (1v91.467 from the firmware list, rather than the beta one). And ran that erasePage script on the left:
Connected >console.log("<","<<",JSON.stringify(process.env),">>",">") =undefined >var f = require("Flash"); =function () { [native code] } >for (var i=119;i>=115;i--) { : print(i); : f.erasePage(i*4096); :} 119 118 117 116 115 =undefined
Though the LEDs are flashing the same as before when I update to 1v92.
Ah, yes - this is the one that I had the beta firmware on.
One thing - I've been screwing around with the NRF.(set/update)Services quite a lot, so I don't know if that got me in a weird state. (I couldn't get custom services to work - and I was hoping that the firmware update might reset things.)
Hey @user132453! Great, I'm glad you found it!
I'm not sure, but I think adding the definitions to the EncodeIR.cpp file seems like a good idea to me too. It seems like there was a PR that added them but couldn't be merged probonopd/MakeHex#5, so maybe they'd be up for a new one?
You may have come across this already, but I plonked some very rough notes about wasming the code: https://github.com/benfoxall/puckmote/tree/main/src/wasm (just added a diff of the cpp file that I'd left off before)