Display Puck.js temperature on webpage

Posted on
  • Hi! So I have an idea to make a javascript webpage that gives you certain information based on the puck.js temperature reading. What I don't know what to do is how to get the data from the puck.js to the webpage. This is an idea for a hackathon in the future, so I want to see if this would be possible. Any help would be absolutely amazing!

  • So I tried following the tutorial, and I got it to light up the LED's and have the lightbulb on the page change colors based on the light level of the room. But when I get to the part titled, "multiple connections", also the part where it gets the temperature, it doesn't even prompt to connect the bluetooth. I even tried the "try me" button and it still gives me the same result. Besides that, it was very helpful. Any ideas?

  • I don't have any ideas, but I am sure if you wait @Gordon will.

  • Okay, thank you. @Gordon any help would be amazing!

  • Sorry for the delay - I just checked on this and it was just that the tutorial had slightly the wrong puck.js library link (for some reason the HTTPS cert didn't match so now Chrome blocks it - I don't believe it did before). Multiple connections should work now:


    That seems to be the getTemperature one too, so I think that's the only issue?

    If you have any issues it's worth bringing up the chrome dev console as that'll tell you if there are any errors.

  • @Gordon Thank you so much! It is getting the temperature perfectly! I appreciate it!

  • This is a bit like what I have been looking for. I would like to export the temperature reading (with timestamp) to a webpage that I can access anywhere. What I don't understand yet is how to upload E.getTemperature() to the internet and then make it human readable. Any suggestions?

  • @Icarus have you seen https://www.espruino.com/Web+Bluetooth ?

    You can basically just do Puck.eval("E.getTemperature()") from the webpage and that'll execute the command on the Puck and give you the temperature as a result. For what you do after there are a million options - whether that's just displaying it on the webpage, adding it to Google Sheets, or uploading it to some online database.

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

Display Puck.js temperature on webpage

Posted by Avatar for tlh @tlh