Using Puck as a single button keyboard

Posted on
Page
of 3
Prev
/ 3
Next
  • Are you sure it's not that you're connected to the device with Android? Or that the Mac has now tried to connect as a HID device?

    Try what's on:

    http://www.espruino.com/Puck.js#troubles­hooting

  • Hi Gordon.... All where good but doesn't work.... So I've disconnected BLE dongle, restart Mac and then see it... so it's ok now! Then....

    reprogramed HID Space key : always Working well on my MAC

    Once the device is reconnected to the PC you previously said :

    > Make sure Puck.js is on the 1v92 firmware (Done)

    > Connect with the Web IDE on your Mac (Done)

    >Program the code above (Done)

    >Disconnect from the IDE on the Mac (Done)

    >Make sure you follow these instructions: espruino.com/Puck.js#i-can-t-reconnect-t­o-my-puck-js-on-mac-os (OK)

    >If you'd used the Puck as a HID device n your Mac it's very likely that your Mac is repeatedly connecting to Puck before Windows can do it
    (I know it but I always USE the same Dongle for both computer so it never try to reconnect Dongle is now plug into the PC)

    >Connect via the Bluetooth Pairing menu on your Windows PC. The keyboard icon should appear to the left of it and it'll start working

    Puck.Js4fe1 Connected on the PC (no keyboard icon) but don't seem to acquire it like a HID device there's a thing to do that I missed !?

    -Regards

  • And you didn't reset Puck.js at all between times? Perhaps you could try disconnecting and then reconnecting on the PC?

    Please can you post up a screenshot of the Bluetooth menu on the PC?

  • Hi Gordon,

    Sorry my Windows is in french but it say connected... Where I'm suppose to see Keyboard Icon ?

    IF we really can't make it work on windows like it should... I've read in tutorials we can programmed it into our own app via a device ID. Can you tell me more about... Thanks! We will need lot more if it works...
    -Ronny

  • Hi - I'm afraid I can't see that image. It looks like you need to be signed in to dropbox to see it. You should just be able to upload images straight to the forum though.

    I don't have my windows 10 PC to hand to take a picture, but I found the image below on the net. The Keyboard icon should be showing where the blue icons are in the picture.

    It really should work fine - I've had plenty of people using this without trouble.

    And yes, you can communicate directly with your own app using the standard windows 10 Bluetooth APIs. There's some example code for doing that here: https://github.com/espruino/winnus/blob/­master/cpp/winnus.cpp

    The code above communicates with Puck.js's Bluetooth UART interface, which is enabled by default. If you wanted to make your own services and characteristics and modify the UUIDs in that file then you could do that too though.


    1 Attachment

    • remove-bluetooth-device-windows10.jpg
  • Hi Gordon,
    Sorry here it is:


    1 Attachment

    • Capturepuckjs.png
  • It worries me that none of the icons are blue for you.

    I'm pretty sure that means that your computer isn't actually seeing any of those devices? If you run nRF Connect on your phone, do you actually see the device advertising during that time?

    Are you sure that Puck.js is not still connected to your Mac in some way, or to some other device?

  • Hi Gordon,

    I'm agree no one icon are blue but all my others devices are working and it say connected. If running NRF connect, yes I see it and I can connect, not a good news!? I also see it In my phone list, this is bad also! For Other devices trying to connect or still connected stop asking please I know I can't connect it twice I always kill bluetooth on all my other devices.... The problem is with with windows. What I don't understand it is the same bluetooth Dongle I use to make it work on my MAC IOS and My PC. So it could not be the Dongle itself ! Ok I made several tests it say at install Puck.JS driver error.... I Will try to find latest Driver, but I never read nothing about Driver! At third try I where able to install it without driver error, running Web IDE on Windows programmed spacebar command... Still not working!

  • Hi Gordon!!!!!!!!!!!! I
    I succeeded!!!!! I have delete it many times and re-install!!!! Now it's working! My god! Continue to test it!!!!

  • Hi Gordon, Me again! I don't understand anything aboutthis device ! It's working all the week-end perfectly until I removed the Battery, to test with a multimeter (ohm meter) The push button type N/O type or N/C type. We need a external Push button. Then re-insert Batt. Impossible to make it work again. Windows don't want to pair it (say bad driver vesrion), it see it but don't want to pair. So I tried with my MAC, same thing. My android same thing. Don't ask if a other bluetooth device is still trying to connect or connected to the device, I always take care to put them off. So I have flash Firmware again. Retry on Windows, don't want to pair it, Win Espruino app doesn't see it also! So tried on the MAC with WEB IDE. It see it and connected on it, reprogrammed spacebar command in it. Impossible to make it work again on my MAC... It's really hard to paired it also. This time each time I'm trying to pair it the three LED flash for 1 or 2 seconds following by a fast flash of red led. It never happend before when I made it work and from beginning of my experimentations with Puck.Js. I've restarted many time My MAC and My PC during my debug process....
    Question, When removing battery we loose all data javascript previously programmed in it right ?
    Do you have same device but with WIFI communication ?

  • Unless you type save(), all the code that was running on Puck.js will be lost - so I think that was your problem initially when you removed the battery. It's worth reading http://www.espruino.com/Quick+Start#star­t-writing-code- for an intro, and how to write code that runs at startup.

    What drivers did you reinstall? Puck.js should need no drivers, so all I can assume is that it is the drivers for your Bluetooth LE dongle that Windows is complaining about?

    However the 3 LEDs lighting up points to some problem in Puck.js's software. It's most likely related to bonding.

    When you do manage to connect, please could you run the following code on Puck.js:

    var f = require("Flash");
    for (var i=119;i>=115;i--) {
      print(i);
      f.erasePage(i*4096);
    }
    

    That should clear out any saved code, along with the bonding information - which will hopefully return it to normal and fix the 3 LED lighting issue. I'm hoping to try and fix that properly in a later release, but am having trouble reproducing it here, and it seems to be an internal issue in Nordic's software libraries :(

  • As for WiFi, I have this: http://www.espruino.com/WiFi

    But not in the Puck.js form factor - WiFi just uses too much energy for it to be possible to run it off a coin cell for any sensible length of time

  • Hi Gordon, My god I past at least 5 hours yesterday to make it work... Clear Code worked. For Driver I found nothing of corse so I've not install any Drivers... When you say unless you type save(). Let me more details please.... There's a way to don't loose data in it when removing Battery !? Just typing save() at the end of the spacebar command ? For Wifi it is same way to program spacebar command in it ? Will read more about! Thanks again! -Ronny

  • Take a look at http://www.espruino.com/Quick+Start#star­t-writing-code- - or in fact a lot of the other tutorials mention it as well. You just type save() on the left hand side of the IDE when your code is working, and it will be saved to flash.

    You might also want to execute something when power is applied - for instance the setServices command - so just do that inside an onInit() command.

    And no - you can't emulate a keyboard over Wifi, so you'd have to do something completely different for the Espruino Wifi, writing some software for your PC that would communicate with Espruino over the network connection

  • Mmmm! I tried save() , but I had to re-install frimware and clear code again to make it work again! What kind Of command setServices or onInit() I could need in relation with save() command !? Can you follow Forum post links or tutorial. It seem to have a lot of problem with save() command. My code is really simple, but We can't manage to reprogram at each time, each consumer units when they will have to change the battery... We appreciated if you can leave us a key in hand command line code to perform this, if it's really possible! thanks again Gordon!

  • What happens when you type save() that means that you need to re-update the firmware? Updating the firmware won't actually delete your saved code so I wonder what's happening.

    Try uploading this code:

    var kb = require("ble_hid_keyboard");
    function onInit() {
      NRF.setServices(undefined, { hid : kb.report });
      setWatch(btnPressed, BTN, {edge:"rising",repeat:true,debounce:50})­;
    }
    
    function btnPressed() {
      kb.tap(kb.KEY[" "], 0);
    }
    

    from the right-hand side, and then type save() on the left-hand side. I'm sure this works just fine on 1v92.

  • Hi Gordon, Thanks for the tips, Just want to clarify if following your instructions, we don't need click on upload icon at right ? Save() will do the thing ! If code saved then there's a way to clear the code or modify after save() action?

  • Have you read that quick start guide I've linked above? I think that would answer your questions.

    Just want to clarify if following your instructions

    You do need to upload as well.

    • Copy code above to right hand side of IDE
    • Connect to Puck
    • Click the upload button
    • Go to left-hand side
    • Type save()

    Then the code will run, but will also be saved.

    If code saved then there's a way to clear the code or modify after save() action?

    You can easily just connect and modify it right after, but in some cases (not the code above) you might be able to do something that stops you from logging in.

    In that case, see this: http://www.espruino.com/Puck.js#i-saved-­some-code-and-my-puck-js-no-longer-works­

  • Go to right-hand side
    Type save()

    typo: is it not left-hand side, then save()

  • Thanks! Just updated it :)

  • Gordon,

    In the documentation: https://www.espruino.com/Puck.js+Keyboar­d
    It states that:

    Note: Puck.js's 1v89 firmware doesn't support Bonding (needed by Windows HID devices). Pucks can work as keyboards on Android, Mac OS and Chromebook but until bonding is added they won't work on Windows.

    In version 1v92 has windows support been added?

    Is there a page with release notes on the firmware versions?

    Thanks

    Edit: Found the release notes: https://github.com/espruino/Espruino/blo­b/master/ChangeLog

  • Also having an issue with 1v92 of the firmware for puckjs connecting to windows 10.
    It will not pair even though it appears as a device. Rolling back to 1v91 and the device will pair.

  • I updated the docs recently but they haven't made it into the site yet I'm afraid. Yes, 1v92 will do bonding for Windows.

    Do you get any error message when trying to pair the device on windows? And are you sure you do that after having uploaded the BLE HID code. Do the LEDs flash on the Puck at all?

  • I didn't have any code relating to HID on the puckjs when I updated the firmware to 1v92. It just wouldn't pair with windows. The error that I got was: "Try connecting your device again". I tried multiple times and it wouldn't connect.

    I have now got 1v92 working with windows. Before I was unpairing the device and then uploading the code, didn't realise that it would pair with windows and upload the firmware via an ios device at the same time. This time I left it paired with windows and it works.

  • Ok after un-pairing and re-pairing I get the same issue with the error: "Try connecting your device again". But now with the code from your comment #41.

    Edit:
    Something is causing an error on the puckjs because I have it blinking a light to show that its running and this stops as soon as I try to pair.

    var kb = require("ble_hid_keyboard");
    var on = false;
    
    function onInit() {
      NRF.setServices(undefined, { hid : kb.report });
      setWatch(btnPressed, BTN, {edge:"rising",repeat:true,debounce:50})­;
      flashLED();
    }
    
    function btnPressed() {
      kb.tap(kb.KEY['c'], 0);
    }
    
    var flashLED = function() {
      on = !on;
      LED1.write(on);
      var interval;
      if(on) {
        interval = 5;
      } else {
        interval = 5000;
      }
      setTimeout(flashLED, interval);
    };
    

    It doesn't seem to be code specific either because I tried pairing with no code running.
    And again rolling back to 1v91 and there are no pairing issues.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Using Puck as a single button keyboard

Posted by Avatar for sammachin @sammachin

Actions