ESPloradores
Published © LGPL

Hello World Thinger.io –BLINK

A real-time blink in a IoT platform that's easy to use and easy to understand.

BeginnerFull instructions provided1 hour7,785
Hello World Thinger.io –BLINK

Things used in this project

Hardware components

NodeMCU Development Board
×1
LED
×1
Resistor 100Ω / 0,25W
×1
Protoboard
×1
Jumper wires
×1

Software apps and online services

Thinger.io Platform
Thinger.io Platform
Arduino IDE
Arduino IDE

Story

Read more

Schematics

BLINK

Code

Hello World Thinger.io -Blink-

Arduino
/*
 Hello World Thinger.io -Blink-
 
 This code is under public domain.
 Dani No www.esploradores.com
 */
 
#include <ESP8266WiFi.h>       //ESP8266 WiFi connection library
#include <ThingerESP8266.h>    //THINGER.IO library
 
// Thinger.io connection parameters
#define user "ESPloradores"
#define device_Id "NODEMCU_LED"
#define device_credentials "Rzdl9J%3uAHj"
ThingerESP8266 thing(user, device_Id, device_credentials);
 
// WiFi connection parameters
const char WiFi_ssid[]="********";      //WiFi SSID
const char WiFi_password[]="********";  //WiFi password
// Global variable
int led = 2;       // GPIO02 - D4 
 
void setup() {
 
 // Initialization of the WiFi connection with THINGER.IO
   thing.add_wifi(WiFi_ssid, WiFi_password);
 
 // Initialization of the LED
   pinMode(led, OUTPUT);
 
 // Resource for changing LED status from THINGER.IO
  thing["LED"] << [](pson& in){
    if(in.is_empty()){
      in = (bool) digitalRead(led);
      }
    else{
      digitalWrite(led, in ? HIGH : LOW);
      }
    };
  }
 
void loop() {
  thing.handle();
  }

Credits

ESPloradores

ESPloradores

1 project • 1 follower

Comments