GithubHelp home page GithubHelp logo

blynk's Introduction

Blynk

Sample codes for Blynk virtual pins

Code Descriptions

This is to initilizing of Blynk connection with the Blynk server

define BLYNK_PRINT Serial // Comment this out to disable prints and save space include <ESP8266WiFi.h> include <BlynkSimpleEsp8266.h>

Setting up of DHT sensor

You can use any DHT sensor, library avaialble at github ( Thanks )

include "DHT.h" define DHTPIN 5 // pin D1 in Original Board define DHTTYPE DHT11 // DHT 11 DHT dht(DHTPIN, DHTTYPE);

Global data setting

const int LED_pin = 16; //Inbuilt LED ( Only available in Original Board) float h =0.0; float t =0.0;

Wifi Connection details

const char* ssid = "TP"; const char* password = "12345678";

You have to get this code from Blynk ( It is better to email it)

char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxxxxx"; // Blynk authorization key

To improve and speed up of compiling

void setup(); void loop();

void setup() { Serial.begin(11520); //baud rate should be set as 74880 Serial.println("Start"); pinMode(LED_pin, OUTPUT);
Blynk.begin(auth, ssid, password); delay(1000); dht.begin(); delay(1000); // to stable the DHT

// LED blynking to indicate debugs digitalWrite(LED_pin, HIGH); // turn the LED on delay(250); // wait for a 250ms digitalWrite(LED_pin, LOW); // turn the LED off delay(250); } //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Please Note: You can create any number of virtual pins to do anythings

BLYNK_READ(V0){ // You have to make virtual pin in Mobile phone > Blynk h = dht.readHumidity(); Blynk.virtualWrite(V0, h); }

BLYNK_READ(V1){ t = dht.readTemperature(); Blynk.virtualWrite(V1, t); }

BLYNK_READ(V2){ float hic = dht.computeHeatIndex(t, h, false); Blynk.virtualWrite(V2, hic); }

//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

void loop() { Blynk.run(); // Main function to run Blynk app }

blynk's People

Contributors

niwantha33 avatar

Stargazers

realJustinBruce avatar

Watchers

James Cloos avatar  avatar Dilshan Ramesh avatar

Forkers

nodemcu-zero

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.