Controlling LED using javascript

Connections are properly connected with the wifi bolt module, The wifi module is with stable network connection(blue and green light) and finally I got the output as you said in the instructions. The output in the control page(google chrome) is correct but if I click the LED ON or LED OFF button the led doesn’t works.
Instead of that I move to the bold cloud page->API option->Build API request->Test API. Then only the LED got ON condition.
Why and For what reason this kind of error has been occured?
Could anyone please share information reading my queries…!

Share the code you’re trying to implement.

What output in chrome you are talking about


Can you share the code? Since the API call is working fine, your hardware connections are correct.

The issue seems to be with your code.

it might be possible your code is not correct may be you are using other GPIO pin of the module and in code you have consider other pin so please go through your code and don’t forget to link the device with your project. there is chances you didn’t link the project with your device .


Sorry for the late reply due to University Examination.
Thank you…! for your reply.

Correction -

  1. digitalWrite - W is capital
  2. HIGH - all capital
  3. LOW - all capital
  4. analogWrite - W capital
1 Like

You must have had your API rate finished for the day. Wait 6 hours and try again.

Hi @yogamalinirajendran,

Check the suggestions shared by @akshayan.sinha.

Try this:

singleButton({name:“Led On”, action:“digitalWrite”,
pin:“0”, value:“HIGH”})

singleButton({name:“Led Off”, action:“digitalWrite”,
pin:“0”, value:“LOW”})

@rahul.singh1 Okey sir. Thank you!!

Thank you…! I got output as you said @akshayan.sinha . But in the output page Fan on and Fan off option what is it?

Your 3rd and 4th buttons are Fan On and Fan Off respectively. Do the following changes to control your LED’s brightness -

  1. Copy the 3rd single button whole code.
  2. Delete the 4th single button whole code.
  3. Paste the 3rd single button twice, so that there are 3 more of the buttons, Total buttons - 5 (including Led On and LedOff.
  4. For 3rd single button changes are, name - LED full, pin - 1, value 255
  5. For 4th single button changes are, name - LED mid, pin - 1, value 135
  6. For 4th single button changes are, name - LED low, pin - 1, value 45

Connect another LED to your pin 1, or if you have only one resistor, then remove the LED from pin 0 and attach a similar connection with pin 1. After this, visit the hardware configuration ->delete configuration -> add the pins and assign variables accordingly to your pins --> and save it.

What you’ll see is, you can control the brightness of LED with analogWrite value. which varies from 0-255. A similar scenario could be seen if you had connected a motor with analogWrite.

@akshayan.sinha with the help of Fan on and Fan off mode are used for variation of LED brightness right?

Those are not modes. You can edit and write ANY name on the buttons.

Okey. Thank you…! for your reply.

so you have to first go to configure icon check the code first as shown in the training
controlling led using javascript code, javascript is a scripting language so and case sensitive so you have to check the capital latters and small letters. as like action:digitalWrite or value:HIGH. and then your problem get solved accurately.

it happened with me too,
After the configuration of product ,make sure you exit it . instead if you go back although the connections ,code and the output you get in control page is correct the LED doesn’t glow.