Bolt with Javascript-Not working


#1

<!doctype html>

BOLT

LED Controller


ON OFF

#2

Hi,

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.


#3

Please check if bolt.js file is present in bolt SD card.
If the bolt.js file is missing then download it from https://github.com/Inventrom/bolt-sdcard-files and copy it to SD card.
credits @rahul.singh.


#4

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.


#5

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 -
bolt_ip/digitalWrite?pin=0&state=HIGH
For example
92.168.4.2/digitalWrite?pin=0&state=HIGH


#6

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


#7

@avidillon5,
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.


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

#9

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


#10

Hi @avidillon5 ,
bolt.js file is not present in Bolt Sd card. Please download the files from here https://github.com/Inventrom/bolt-sdcard-files and copy/upload to Bolt Sd card.


#11

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


#12

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


#13

Hi @avidillon5
Please post your solution here.


#14

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