Avatar for benjaminbenben

benjaminbenben

Member since Apr 2017 • Last active Feb 2021
  • 2 conversations
  • 13 comments

Most recent activity

  • in Projects
    Avatar for benjaminbenben

    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.

  • in Projects
    Avatar for benjaminbenben

    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, and puck-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!

  • in Projects
    Avatar for benjaminbenben

    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!!

  • in Projects
    Avatar for benjaminbenben

    Bit more hacking/fixing, you can set the name of devices now too.

  • in Projects
    Avatar for benjaminbenben

    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.

  • in Projects
    Avatar for benjaminbenben

    I've been playing around with building a chat ui for connecting to Espruino boards.

    https://benjaminbenben.com/microchat/

    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.

  • in General
    Avatar for benjaminbenben

    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!

  • in Puck.js, Pixl.js and MDBT42
    Avatar for benjaminbenben

    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.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for benjaminbenben

    @Gordon cheers! I've put together a bit of a test page here https://benjaminbenben.com/espruino-pixe­ls/ 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.

Actions