Java Script with Proximity Sensor [Resolved]

Please help me with the code below,

BOLT

Sensor Data

Read Pin

what should I enter in the “??” area,
also how to monitor continuously data?

somebody help me on this !

To get a contunes data update, I suggest you try the Bolt cloud. Specially the new updates given to the Beta Testers solve the issue. Try that out.

I just started that module, I will try it, come back here if things are not solved!

Kindly advise how to post the coding(display source code) in the forum, as it is displaying as a html output.

Just remove the HTML Tags. Should work. (I hope)

1 Like

Let me try on my next question on the forum!

The code is not working, on clicking the button, the page remains the same.

This is not working!!

Hi @mariarichy !
Right click on the page and do inspect element then click on the console. See if any error or warning message is there.

Yes there is as below

@mariarichy share your code with us.

Please check my code,

you seem to have a mistake in the brackets of your function call digitalRead(4,output);
another point which im not sure about is javascript is case sensitive , So just in case use the same case for both the id attribute of the span and the parameter of the function( lower case ‘output’ in both places)

Tried changing the above said, still the same error continues!

Hi, the correct syntax is

Note output needs to be surrounded by double quotes identifying it as a string and the entire function needs to be surrounded by single quote.

Hey Naik,

I tried that too, the error says for the below code “Uncaught SyntaxError: Unexpected token }”

 
 
 
BOLT

 
 
 
 

Sensor Data

Read Pin

@PPV Just adding the code between “pre” tag is working, for reference you can check the below page…:slight_smile:!

How do I Display HTML code on Web Page?
12 Answers

onclick="digitalRead(4,“output”);

change to

onclick=‘digitalRead(4,“output”);’

As i mentioned earlier the digitalRead(4,“output”); needs to be surrounded by a single quote

1 Like

Sir, I have a very important query . As i am an ece student i have little knowledge of the xml , javascript.I was goiung through the bolt.js file in the sd card reading the back end code .Usually i write the microcontroller code in embedded C ,but when i saw the bolt.js script it was all written in the xml and java script .So my request is **can you kindly explain what exactly is written in the script and the UPLOAD file of the sd card ** Its very serious and important to me as i am a newbie to web dev and would like you to share your knowledge .
THANKYOU!