Finalmente andiamo ad utilizzare la versione più piccola e comune della ESP8266, appunto la ESP-01 .
Collegamenti e primo utilizzo.
/* Dave Calaway
This example code is in public domain.
**************************************************************
This example runs directly on ESP8266 NodeMCU 0.9 chip.
Please be sure to select the right ESP8266 module
in the Tools -> Board menu!
Change WiFi ssid, pass, and Blynk auth token to run :)
**************************************************************/
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <Servo.h>
Servo myservo;
int button;
int pos;
// You should get Auth Token in the Blynk App.
char auth[] = "authtoken";
void setup() {
Serial.begin(9600);
Blynk.begin(auth, "ssid", "pass");
myservo.attach(5); // D1 physical pin
}
BLYNK_WRITE(V0) {
button = param.asInt();
}
BLYNK_WRITE(V1) {
pos = param.asInt();
}
void loop() {
Blynk.run();
if ( button == 1 ) {
myservo.write(pos);
}
else
myservo.write(10);
}
Riporto il mio pannello nell'App: