Controlling puck.js over web BLE #1213
Replies: 8 comments
-
Posted at 2019-02-13 by @yerpj IMO this doesn't work because at the time you call
Then on your web page , the command should be |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-02-13 by Qbza Ok so i have uploaded the script into the puck and changed the buttons onClick function, now when i try to click the advertise button, it is giving me UncaughtSyntaxError. I have also corrected the code on the disconnect device button as it has a little spelling mistake. The code looks like this now:
I have included the errors i am getting. Attachments: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-02-13 by Qbza Ok a little update, i have managed to close the connection with Puck.close(); function. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-02-13 by @yerpj Dont' you have to escape the
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-02-13 by Qbza Well, from what i see the double quote has been closed, but maybe there is something im missing out?
It is telling me that it is a syntax error meaning that the link or entire function is wrongly typed? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-02-13 by Qbza UPDATE The puck is receiving the command when i use the console
But throws error as soon as i try do it using the button. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-02-13 by @gfwilliams The issue is that you have a quote inside a quote... Try:
Basically it's the web browser itself thinks the string There are other ways of doing it that are nicer, for instance you could use a third type of quotes! The templated String ones:
Or you could add a function inside a |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-02-13 by Qbza Jean-Philippe_Rey and Gordon thank you very much for your help, it works the way i want it to now, i knew it was something with the quotes but couldn't figure it out. For any one else that wants to achieve something similar, this is the code:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-02-13 by Qbza
Hi, i am trying to control the puck.js from a web bluetooth website. I am not a programmer but i do understand some basics.
So far i have some basic code, grabbed from one of Gordons tutorials, what i am trying to achieve is to make the puck advertise a link and then of course disconnect it from the computer in order for it to advertise. if anyone knows a quick and easy solution please respond, would be really grateful.
Here is the code.
Beta Was this translation helpful? Give feedback.
All reactions