Mood lamp programming code


#1

I want to make a MOOD LAMP USING BOLT IOT WHAT WOULD BE THE CODE AND HOW TO INSTALL THE CODE.


#2

@saifquraishi387, you will need to connect a multicolour LED to your Bolt device and then control it via commands from the Bolt Cloud.
Please share what you have done so far, so that we can help you out.


#3

But how can I control the colour of light?


#4

@saifquraishi387 Have a look at the project below,


Basically, you can control the color of the LED strip using different values of Red, Green and Blue. I think, you might need a Arduino also for this.
@vinayak.joshi - Can you please share how you had done the same for the Alexa frame?


#5

@shoeb.ahmed: The above project allows you to change the pattern displayed on an RGB LED strip based on WS2811, using an Arduini and the Bolt.

To change the pattern, you have to make a serialWrite API call.
This has been done in HTML code using the following function

function cmd_serial_write(data_val){
   $.get("https://cloud.boltiot.com/remote/"+"Your API Key Here"+"/serialWrite?data="+data_val+"&deviceName="+"Your Bolt ID here");
} 

For the hackster project, you have to place the device id and the API key in this link, and have the data value to be “a”

If you want to set up specific colors, do the following steps

  • The Arduino code has to be modified with a specific function for displaying the color you want
  • Place the function name in the ‘gPatterns’ array.
  • Decide a caracter code which you want to send to enable the pattern. (For example ‘R’ for red, ‘B’ for blue etc), and create a new case in the while loop, with the character as the case.
  • In the case you have to ‘gCurrentPatternNumber’ value to the location of your pattern function inside the ‘gPatterns’ array.

To setup the system to work with Alexa, you can use the instructions mentioned in the following link

The only difference you will have to make in the above project is the GPIO control command. Instead of the GPIO control command, you have to use the following link, with the correct data values for the pattern you want to run on the LED.

"https://cloud.boltiot.com/remote/<API key>/serialWrite?data=<pattern case code>&deviceName=<device id>"

#6

Can you explain the full process.


#7

@saifquraishi387, I suggest you have a look at the link that Vinayak has shared. It should be self-explanatory. In case if you are facing an issue with something particular, do let us know.


#8

What are the different pattern case code?