Changes

Jump to: navigation, search

Blynk

420 bytes removed, 14:30, 24 January 2021
no edit summary
[[File:Blynk-Pinout.jpg|600px]]
== Sparkfun-Blynk-ESP8266 SimpleRead Onboard-Setup a New-Board Button ==
Setup# Install the Blynk App on your Phone# Creat an Account and log in# Scann the QRAuf dem Sparkfun-Code # Follow the steps# If the App is connecting to your Blynk board-ESP8266 Board befindet sich ein Taster, open WLANder sich gut dazu eignet, um zum Beispiel den aktuellen Zustand einer Tür (Reed-Setting and select the boards WLAN by hand#Schalter) in der App sichtbar zu machen. Dieser Taster ist mit '''Pin 0''' verdrahtet und kann ober einen virtuellen Pin gelesen werden.
 '''Onboard-RGB-LED'''* Board: [https://learnwww.sparkfun.com/tutorialsproducts/getting13794 Sparkfun-startedBlynk-withESP8266] * Onboard-Taster an Pin — kann auch über einen externen Taster zischen Pin 0 und GND geschaltet werden* Example-Code (siehe unten)* Example-Blynk-App-Settings (siehe unten)  [[File:Sparkfun-Blynk-ESP8266-LED-Widget-Onboard-Button.jpg|150px]][[File:Sparkfun-Blynk-ESP8266-Read-Onboard-Button.jpg|150px]] <pre> // Sparkfun-Blynk-ESP8266 Read Onboard-Button Example /* Comment this out to disable prints and save space */#define BLYNK_PRINT Serial #include <ESP8266WiFi.h>#include <BlynkSimpleEsp8266.h> // You should get Auth Token in theBlynk App.// Go to the Project Settings (nut icon).char auth[] = "YourAuthToken"; // Your WiFi credentials.// Set password to "" for open networks.char ssid[] = "YourNetworkName";char pass[] = "YourPassword"; #define ButtonPin 0 int prevState = -sparkfun1;int currState = -blynk1;long lastChangeTime = 0; void checkPin(){ // Invert state, since button is "Active LOW" // int state = !digitalRead(ButtonPin); boolean state = !digitalRead(ButtonPin);  // Debounce mechanism long t = millis(); if (state != prevState) { lastChangeTime = t; } if (t -board?_galastChangeTime > 50) { if (state != currState) { currState = state; if (state == 0) { Blynk.virtualWrite(V1, 0); Serial.println("Button Off"); } if (state ==1) { Blynk.196250085virtualWrite(V1, 1023); Serial.890988720println("Button On"); } } } prevState = state;} void setup(){ // Debug console Serial.1429644996 SparkFun-Tutorial]begin(9600);  Blynk.begin(auth, ssid, pass);  // Make ButtonPin default HIGH, and attach INT to our handler pinMode(ButtonPin, INPUT_PULLUP);} void loop(){ Blynk.run(); checkPin();} </pre>
<br>
Blynk.virtualWrite(V6, tempc);
}
</pre>
 
<br>
 
== Sparkfun-Blynk-ESP8266 Read Onboard-Button ==
 
Auf dem Sparkfun-Blynk-ESP8266 Board befindet sich ein Taster, der sich gut dazu eignet, um zum Beispiel den aktuellen Zustand einer Tür (Reed-Schalter) in der App sichtbar zu machen. Dieser Taster ist mit '''Pin 0''' verdrahtet und kann ober einen virtuellen Pin gelesen werden.
 
 
'''Onboard-RGB-LED'''
* Board: [https://www.sparkfun.com/products/13794 Sparkfun-Blynk-ESP8266]
* Onboard-Taster an Pin — kann auch über einen externen Taster zischen Pin 0 und GND geschaltet werden
* Example-Code (siehe unten)
* Example-Blynk-App-Settings (siehe unten)
 
 
[[File:Sparkfun-Blynk-ESP8266-LED-Widget-Onboard-Button.jpg|150px]]
[[File:Sparkfun-Blynk-ESP8266-Read-Onboard-Button.jpg|150px]]
 
<pre>
 
// Sparkfun-Blynk-ESP8266 Read Onboard-Button Example
 
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
 
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
 
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
 
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";
 
#define ButtonPin 0
 
int prevState = -1;
int currState = -1;
long lastChangeTime = 0;
 
void checkPin()
{
// Invert state, since button is "Active LOW"
// int state = !digitalRead(ButtonPin);
boolean state = !digitalRead(ButtonPin);
 
// Debounce mechanism
long t = millis();
if (state != prevState) {
lastChangeTime = t;
}
if (t - lastChangeTime > 50) {
if (state != currState) {
currState = state;
if (state == 0) {
Blynk.virtualWrite(V1, 0);
Serial.println("Button Off");
}
if (state == 1) {
Blynk.virtualWrite(V1, 1023);
Serial.println("Button On");
}
}
}
prevState = state;
}
 
void setup()
{
// Debug console
Serial.begin(9600);
 
Blynk.begin(auth, ssid, pass);
 
// Make ButtonPin default HIGH, and attach INT to our handler
pinMode(ButtonPin, INPUT_PULLUP);
}
 
void loop()
{
Blynk.run();
checkPin();
}
 
</pre>
<br>

Navigation menu