21-05-2022, 10:46
Witam.
jako laik mam kłopot z przejściem na blynk 2.0
na starym blynk wszystko działało ale na nowym działa wyświetlacz tylko jak się połączy do sieci wifi
połączenie starego
nowy blynk aby się połączyło jest
poniżej cały kod.
jako laik mam kłopot z przejściem na blynk 2.0
na starym blynk wszystko działało ale na nowym działa wyświetlacz tylko jak się połączy do sieci wifi
połączenie starego
Kod:
WiFi.begin(ssid, pass);
Blynk.config(auth, "blynk-cloud.com", 8442);
Blynk.connect();
if (Blynk.connected()) Blynk.run(); else Blynk.connect();
nowy blynk aby się połączyło jest
Kod:
Serial.begin(9600);
lcd.backlight();
sensors.begin();
lcd.init();
lcd.clear();
Serial.println(LED);
Blynk.begin(auth, ssid, pass);
poniżej cały kod.
Kod:
#define BLYNK_TEMPLATE_ID "xxx"
#define BLYNK_DEVICE_NAME "xxx"
#define BLYNK_AUTH_TOKEN "xxx"
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <ESP8266WiFi.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <BlynkSimpleEsp8266.h>
#include <Timers.h>
#define BLYNK_PRINT Serial
#define D1 5
#define D2 4
#define D3 0
#define treconnect 30
float tempC = 0;
int liczreconnect = 10;
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "xxx";
char pass[] = "xxx";
LiquidCrystal_I2C lcd(0x27, 20, 4);
OneWire oneWire(0);
DallasTemperature sensors(&oneWire);
Timers <3> akcja;
BlynkTimer timer;
int stanLED_ok=0;
int LED;
void setup()
{
Serial.begin(9600);
lcd.backlight();
sensors.begin();
lcd.init();
lcd.clear();
Serial.println(LED);
//timer.setInterval(1000L, temp);
Blynk.begin(auth, ssid, pass);
}
//Blynk.syncAll();
void loop() {
sensors.requestTemperatures();
float TEMP1 = sensors.getTempCByIndex(0);
float TEMP2 = sensors.getTempCByIndex(1);
float TEMP3 = sensors.getTempCByIndex(2);
float TEMP4 = sensors.getTempCByIndex(3);
lcd.setCursor(0, 0);
lcd.print("TEMP1");
lcd.setCursor (9, 0);
lcd.print(sensors.getTempCByIndex(0));
lcd.print((char)223);
lcd.print("C");
lcd.setCursor(0,1);
lcd.print("TEMP2");
lcd.setCursor (9, 1);
lcd.print(sensors.getTempCByIndex(1));
lcd.print((char)223);
lcd.print("C");
lcd.setCursor(0,2);
lcd.print("TEMP3");
lcd.setCursor (9, 2);
lcd.print(sensors.getTempCByIndex(2));
lcd.print((char)223);
lcd.print("C");
lcd.setCursor(0,3);
lcd.print("TEMP4");
lcd.setCursor (9, 3);
lcd.print(sensors.getTempCByIndex(3));
lcd.print((char)223);
lcd.print("C");
Blynk.run();
Blynk.virtualWrite(V1, TEMP1);
Blynk.virtualWrite(V2, TEMP2);
Blynk.virtualWrite(V3, TEMP3);
Blynk.virtualWrite(V4, TEMP4);
delay(30);
Blynk.run();
timer.run();
}