IR Sensor only shows value = 0

Hi, I recently got BOLT hardware. I tried to interface an IR proximity sensor with BOLT. However ,the proximity sensor is giving only a ‘0’ value i.e. {“success”:“1”,“value”:“0”} every time even when there is no object in front of it in the 3D space of some distance around the sensor.
The ACTIVE LOW Sensor must give
•{“success”:“1”,“value”:“1”} - If there is no obstacle in front of it.
•{“success”:“1”,“value”:“0”} - If there is obstacle in front of it.
The Red light on the sensor continuously glows. I turned the screw on blue potentiometer till the light goes off and then used the sensor. However the result did not change.

Does the red light glow when you put your hand infront of it and goes off when you remove the hand?

No, the led remains in its previous state.

By “remains in its previous state.” I believe you mean it is off even when you put your hand in front of it. Correct me if I am wrong.
Here is what you could do:

  1. Check what value it gives you when the light is off. If the light is off the code should give value as 1.

  2. If the value is 1 then you might have rotated the blue potentiometer too much. It should be rotated so much that the red light comes on when you place your hand in front of it

  3. If the value is still 0 then it could mean there is an error in the code. Do share the code with us in this case.

This video might be helpful

The Code is
_<!doctype html>

Sensor data

_ READ sensor on pin 4

My previous reply showed the html output of my code
I have attached the image containing the code here.

So you get Value=0 even when the light is off? If yes then please confirm and also share a picture of your circuit connection.

Please check if you have connected it to Pin 4 only.

Ya, I adjusted the pot such that the light glows when I keep an obstacle in front of it. It is woking fine now and I’m getting proper vaues.
However, while using JS for controlling BOLT GPIO pins, the light is not glowing when I press the buttons.
I believe bolt.js file is not present in the sd card,containing the all the files in the folllowing folder(link)

Also I have sent an image of the code which I uploaded.

I tried out with other digital pins like 0,1,5 etc( i.e replaced x in the code digitalWrite(x,HIGH/LOW) with the pin numbers and also connected led accordingly) and they worked perfectly, i.e. led glows/turns off when I click the corresponding buttons).
However, it is a one time process, i.e. once I click on the “led on” and then turn it off, once again I cant turn the led on when I click on the ON button.
i.e once I glow the led by connecting it to a particular pin say pin 5, I cannot glow it again on the same pin 5, even if I re-upload the code and restart the device.

@kmanishkumark Happy to know that the sensor is working fine now. For the issue with Bolt.js file and LED control I suggest you to create another thread in the forum since this thread is about issue you are facing with IR Sensor. Will answer the query there.

Hii ,how I can store d reading from {value=""}?