Difference between revisions of "Blynk"
From Digipool-Wiki
(→Sparkfun-Blynk-ESP8266 Onboard-NeoPixel) |
(→Sparkfun-Blynk-ESP8266 Onboard-NeoPixel) |
||
Line 20: | Line 20: | ||
'''Onboard-RGB-LED''' | '''Onboard-RGB-LED''' | ||
− | * [https://www.sparkfun.com/products/13794 Sparkfun-Blynk-ESP8266] | + | * Board: [https://www.sparkfun.com/products/13794 Sparkfun-Blynk-ESP8266] |
− | * Type [https://www.led-studien.de/digitale-led-streifen/#ws2812 WS2812] | + | * LED-Type: [https://www.led-studien.de/digitale-led-streifen/#ws2812 WS2812] |
* Libary: [https://github.com/adafruit/Adafruit_NeoPixel Adafruit_NeoPixel.h] | * Libary: [https://github.com/adafruit/Adafruit_NeoPixel Adafruit_NeoPixel.h] | ||
− | * Pin 4 | + | * Pin: 4 |
+ | * Example-Code (siehe unten) | ||
+ | * Example-Blynk-App-Settings (siehe unten) | ||
Revision as of 17:50, 15 January 2021
Setup
- Install the Blynk App on your Phone
- Creat an Account and log in
- Scann the QR-Code
- Follow the steps
- If the App is connecting to your Blynk board, open WLAN-Setting and select the boards WLAN by hand
Sparkfun-Blynk-ESP8266 Onboard-NeoPixel
Auf dem Sparkfun-Blynk-ESP8266 Board befindet sich eine RGB LED, die sich sehr gut dazu eignen, um zum Beispiel deinen aktuellen Zustand anzuzeigen. Diese RGB LED vom Type WS2812 ist mit Pin 4 verdrahtet und kann über die Libary Adafruit_NeoPixel.h angesteuert werden.
Onboard-RGB-LED
- Board: Sparkfun-Blynk-ESP8266
- LED-Type: WS2812
- Libary: Adafruit_NeoPixel.h
- Pin: 4
- Example-Code (siehe unten)
- Example-Blynk-App-Settings (siehe unten)
// Sparkfun-Blynk-ESP8266 Onboard-NeoPixel Example #define BLYNK_PRINT Serial #include <ESP8266WiFi.h> #include <BlynkSimpleEsp8266.h> #include <Adafruit_NeoPixel.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 PIN 4 int stripR = 0; int stripG = 0; int stripB = 0; int stripL = 0; Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, PIN, NEO_GRB + NEO_KHZ800); BLYNK_WRITE(V1) { stripR = param[0].asInt(); stripG = param[1].asInt(); stripB = param[2].asInt(); showRGB(); } BLYNK_WRITE(V2) { stripL = 255 - param.asInt(); showRGB(); } void showRGB() { int r = stripR - stripL; if (r < 0) r = 0; int g = stripG - stripL; if (g < 0) g = 0; int b = stripB - stripL; if (b < 0) b = 0; strip.setPixelColor(0, strip.Color(r, g, b)); strip.show(); } void setup() { // Debug console Serial.begin(9600); Blynk.begin(auth, ssid, pass); strip.begin(); strip.show(); } void loop() { Blynk.run(); }