Difference between revisions of "Blynk"

From Digipool-Wiki
Jump to: navigation, search
(Sparkfun-Blynk-ESP8266 Onboard-NeoPixel)
(Sparkfun-Blynk-ESP8266 Onboard-NeoPixel)
Line 16: Line 16:
 
== Sparkfun-Blynk-ESP8266 Onboard-NeoPixel ==
 
== Sparkfun-Blynk-ESP8266 Onboard-NeoPixel ==
  
[[File:Sparkfun-Blynk-Onboard-NeoPixel-1.jpg|400px]]
+
[[File:Sparkfun-Blynk-Onboard-NeoPixel-1.jpg|150px]]
 
+
[[File:Sparkfun-Blynk-Onboard-NeoPixel-2.jpg|150px]]
 +
[[File:Sparkfun-Blynk-Onboard-NeoPixel-3.jpg|150px]]
 
<pre>
 
<pre>
  

Revision as of 17:27, 15 January 2021

Blynk-Pinout.jpg

Setup

  1. Install the Blynk App on your Phone
  2. Creat an Account and log in
  3. Scann the QR-Code
  4. Follow the steps
  5. If the App is connecting to your Blynk board, open WLAN-Setting and select the boards WLAN by hand

SparkFun-Tutorial


Sparkfun-Blynk-ESP8266 Onboard-NeoPixel

Sparkfun-Blynk-Onboard-NeoPixel-1.jpg Sparkfun-Blynk-Onboard-NeoPixel-2.jpg Sparkfun-Blynk-Onboard-NeoPixel-3.jpg


// 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[] = "0zKSLFgemTMIbKmSZ_4Geh4ovGlCdQZr";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "www_catrineval_de";
char pass[] = "fussball11";

#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();
}