Last logged in: 


[LED vs NodeMCU vs Dashboard]-How to control LED from NodeMCU via IoTtweet Dashboard.

Isaranu, 2016.Oct.3

NodeMCU vs iottweet

From the post of “How to use Node MCU send data to Dashboard”.
You can send any numeric data and string message to display on dashboard by very simple command via IoTtweet.h library.
In this post, we are explain you how to “Control to your IoT device via dashboard”.

For this example, we still use Node MCU with ESP8266 Wifi module same as before post.
On Node MCU, there’s 1 built-in LED on board which it’s connected GPIO no. 16. So, we will use built-in LED for demonstration.

From repository file from github:IoTtweet Library, it’s contained simple code named “ControlMyIoT.ino”.
In this code, we can use command called “ReadControlPanel(userid,key)” to read status digital switch and analog slider on your dashboard.
OK, let’s go start to us it.
NodeMCU vs iottweet
[Step 1] Prepare account, register your device and get device key.
* This step of preparing, we are already explained you in this tutorial.

[Step 2] Change parameter in code for your parameter.
Please fills your parameter in this coding file : “userid”, “key”, “ssid” and “password of wifi”.

NodeMCU vs iottweet
[Step 3] Upload code to device.
Make upload code to your device as normal. When finished, please open a serial monitor to see a result.
At Arduino IDE, go to Tool > Serial monitor

[Step 4] See a result !
On the serial monitor, you will see JSON data return from IoTtweet dashboard.
Let’s you go to IoTtweet dashboard, and make some control on digital switch and see result on serial monitor.

"OFF" switch at dashboard.
NodeMCU vs iottweet
"ON" switch at dashboard.
NodeMCU vs iottweet
About “Analog Slider” controlling, you can slide on tab. Data on these slide will not update, you must to click “Fire to IoT” button to send data to IoT.
Try use it and see something changed on serial monitor.

NodeMCU vs iottweet
Notification display at bottom page when you cick a button.
NodeMCU vs iottweet
From step 4, you will see output as JSON string. That’s contained all of switch status and slider values.
If you can use “ArduinoJson.h” parse these string, you can do it for your next project.
But if you are a beginner coding, we prepared a short and easily command to decode these JSON output string.
In github:IoTtweet v0.2.0, you will find 2 files of sketch name “ControlMyIoT_switch.ino” and “ControlMyIoT_slider.ino”.

NodeMCU vs iottweet
** Before use these 2 file, you should download updated IoTtweet Library v0.2.0 on github. And update it in your Arduino IDE library again.

NodeMCU vs iottweet
In command “ReadDigitalSwitch(userid,key,switch_number)”, this command will return string of “ON” and “OFF” to you follow as switch status on your dashboard.
Argument name “switch_number” is switch number on your dashboard (this is 1-5 as integer).
In this example, we tested to use switch no.1 to control LED turn ON and OFF.
The LED is built-in LED on NodeMCU board (It’s connected on GPIO no.16)

NodeMCU vs iottweet
This example is like same above switch example,
but a return value of command “ReadAnalogSlider(userid,key,slider_number)” will be float type. An argument of “slider_number” is 1-3 follow on your dashboard.
Try it and see a result.

NodeMCU vs iottweet

NodeMCU vs iottweet

Have a nice tweet :)

Leave your message below.
- Support team -