Bolt with Javascript-Not working

<!doctype html>


LED Controller



When posting code on the forum please embed it Preformatted text option or share a screeshot of the code so we can help debug it better.

Please check if bolt.js file is present in bolt SD card.
If the bolt.js file is missing then download it from and copy it to SD card.
credits @rahul.singh.

Bolt.js is on the sd card.Code is also correct.Moreover the connection is fast and strong.Still led is not turning on and off.

Hi @avidillon5
Please do console log in chrome and see if there is any error or warning message is there.
Also first try control the led using the direct command using below sytax -
For example

The led is working when direct command is given but not in javascript.How to do this console log process?

Led is working with direct method means there is some syntax error in javascript code.
Go to Chrome menu and click on View -> Developer -> Javascript Console

Also, do a view source in chrome. Right, Clikc on the page -> View Source -> search for bolt.js and click on the link and see if you are able to see the bolt.js code.

Also share your HTML code here. Copy your code in the box and select the code part and click on </> icon from formatting menu.

<!doctype html> 
<script type="text/javascript" src="/serveFile?filename=bolt.js">setDebug(true);</script> 
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<h3>LED Controller</h3> <br> 
<button onclick="digitalWrite(5,HIGH);">ON</button> 
<button onclick="digitalWrite(5,LOW);">OFF</button> 

bolt.js is not there and there are following errors in console menu.

Hi @avidillon5 ,
bolt.js file is not present in Bolt Sd card. Please download the files from here and copy/upload to Bolt Sd card.

bolt.js is present on sd card but not in console log.I downloaded it and uploaded it into the sd card.

There was problem in bolt.js file.Thanks for support.

Hi @avidillon5
Please post your solution here.

I just copied the contents of bolt.js file into a text document and saved it as bolt.js and uploaded it.Now the code works

1 Like