How to add If condition in javascript
If csv0 and csv1 is above 600 turns ON LED Connected to PIN1
Hi @pavanesleeba,
There are 2 aspects that need to be handled in this code.
I will help you with the Arudino side coding if that is required.
@rahul.singh1will help you out with the Javascript side coding.
But before @rahul.singh1, can help you, can you confirm the following.
In your Arduino code, under what condition are you sending the CSV data?
Are you sending it continuously with some delay, or are you sending it when you receive a command from the Bolt WiFi module?
For your system to work, you will have to setup the Arduino code to send data when it receives a command from the Bolt WiFi module.
Here is an example code you can use to implement the same.
Hi @pavanesleeba,
With the current javascript code, you will not be able to use the data in the javascript if conditions. This is because this code pushes the data directly into the Bolt Cloud database.
You only need to add 1 more line to your Arduino code to enable the required feature.
Change
boltiot.setCommandString("RD\r",pushData);
to
boltiot.setCommandString("RD\r",pushData);
boltiot.setCommandString("push",pushData);
@rahul.singh1, will help you out with the javascript side of the code.