Uji Baris LED dengan Blynk Web Dashboard dan Android App

Web Dashboard

Di bagian awal akan dicatatkan dokumentasi pengendalian 5 jalur keluaran digital (D0~D5) dengan memanfaatkan web dashboard.

Gambar 1.
Gambar 2.
Gambar 3.
Gambar 4.
Gambar 5.

Android App

Gambar 6.

Di smartphone Android, pengguna dapat mengawali pembuatan antarmuka dengan memasuki Developer Mode.

Gambar 7.
Gambar 8.
Gambar 9.
Gambar 10.
Gambar 11.

Untuk keperluan yang sama tombol/sakelar lain dapat dibuat  dan disesuaikan dengan cara yang sama.

Gambar 12.

Contoh kode yang perlu dioperasikan di sistem papan Arduino bisa disalin dari Pastebin atau di bawah ini. 

/*************************************************************
  Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest

  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Follow us:                  http://www.fb.com/blynkapp
                                

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************
  This example runs directly on ESP8266 chip.

  Note: This requires ESP8266 support package:
    https://github.com/esp8266/Arduino

  Please be sure to select the right ESP8266 module
  in the Tools -> Board menu!

  Change WiFi ssid, pass, and Blynk auth token to run :)
  Feel free to apply it to any other example. It's simple!
 *************************************************************/

/* Comment this out to disable prints and save space */
//#define BLYNK_PRINT Serial

#define BLYNK_TEMPLATE_ID "isiDenganPengenalTemplate"
#define BLYNK_DEVICE_NAME "Uji baris LED Dev 01"
#define BLYNK_AUTH_TOKEN "isiDenganAuthToken"

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = BLYNK_AUTH_TOKEN;

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "mySSID";//Enter your WIFI name
char pass[] = "myPASS";//Enter your WIFI password

BlynkTimer timer;
WidgetLED led1(V4);

BLYNK_WRITE(V0){
 int pinValue = param.asInt();
 digitalWrite(16, pinValue);
}
BLYNK_WRITE(V1){
 int pinValue = param.asInt();
 digitalWrite(5, pinValue);
}
BLYNK_WRITE(V2){
 int pinValue = param.asInt();
 digitalWrite(4, pinValue);
}

BLYNK_WRITE(V3){
 int pinValue = param.asInt();
 digitalWrite(0, pinValue);
}

void bacaD5(){
  int val_D5 = digitalRead(14);
  if(val_D5 == HIGH){
    led1.on();
  }
  else{
    led1.off();
  }  
}

void setup()
{
  // Debug console
  //Serial.begin(9600);
  pinMode(14, INPUT); //D5 GPIO14
  pinMode(16, OUTPUT); //D0 GPIO16 
  pinMode(5, OUTPUT);  //D1 GPIO5
  pinMode(4, OUTPUT);  //D2 GPIO4
  pinMode(0, OUTPUT);  //D3 GPIO0
  pinMode(2, OUTPUT);  //D2 GPIO2
  digitalWrite(16, HIGH); //Hanya dipakai untuk display LED
  digitalWrite(2, HIGH); //Hanya dipakai untuk display LED  
  Blynk.begin(auth, ssid, pass);
  timer.setInterval(1000L, bacaD5);
}

void loop()
{
  Blynk.run();
  timer.run();
}