Blynk-cloud.com is the old blynk server, the new blynk server is blynk.cloud
also, Blynk uses 443 port for TLS connections and 80 port for plain connections
@Kamran the hardware that @zkz is using is a NodeMCU. As a said to you in a different topic, your life would be much easier if you were also using a NodeMCU or ESP32.
When you use an Arduino + ESP-01 which is functioning as a WiFi modem in AT mode then you have very limited control over your WiFi system.
Another problem. I need to use wifi.manager to manual connect to WIFI.
And it’s the same problem. LCD only works when connected to wifi.
Is it possible to make a code to work lcd with temperature without connecting to wifi?
But as you aren’t telling us what changes you made to add WiFi manager to your existing sketch, or even shared you working sketch prior to adding-in WiFi Manager, its impossible to explain how to do this in your case.
BTW, have you looked at Blynk Edgent as an alternative to WiFi Manager?
code.
My dream is.
“Put ssid and pass, and if Wi-Fi is not connected, make AP - Wi-Fi manager… but LCD must work all the time.”
of course only wifi manager is enough
#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);
// put your setup code here, to run once:
Serial.begin(115200);
WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP
// it is a good practice to make sure your code sets wifi mode how you want it.
Blynk.config(auth);
Blynk.connect();
if (Blynk.connected()) Blynk.run(); else Blynk.connect();
//WiFiManager, Local intialization. Once its business is done, there is no need to keep it around
WiFiManager wm;
// reset settings - wipe stored credentials for testing
// these are stored by the esp library
wm.resetSettings();
// Automatically connect using saved credentials,
// if connection fails, it starts an access point with the specified name ( "AutoConnectAP"),
// if empty will auto generate SSID, if password is blank it will be anonymous AP (wm.autoConnect())
// then goes into a blocking loop awaiting configuration and will return success result
bool res;
// res = wm.autoConnect(); // auto generated AP name from chipid
// res = wm.autoConnect("AutoConnectAP"); // anonymous ap
res = wm.autoConnect("AutoConnectAP","password"); // password protected ap
if(!res) {
Serial.println("Failed to connect");
// ESP.restart();
}
else {
//if you get here you have connected to the WiFi
Serial.println("connected...yeey :)");
}
}
void loop() {
// put your main code here, to run repeatedly:
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(" C");
lcd.setCursor(0,1);
lcd.print("TEMP2");
lcd.setCursor (9, 1);
lcd.print(sensors.getTempCByIndex(1));
lcd.print(" C");
lcd.setCursor(0,2);
lcd.print("TEMP3");
lcd.setCursor (9, 2);
lcd.print(sensors.getTempCByIndex(2));
lcd.print(" C");
lcd.setCursor(0,3);
lcd.print("TEMP4");
lcd.setCursor (9, 3);
lcd.print(sensors.getTempCByIndex(3));
lcd.print(" C");
Blynk.run();
Blynk.virtualWrite(V1, TEMP1);
Blynk.virtualWrite(V2, TEMP2);
Blynk.virtualWrite(V3, TEMP3);
Blynk.virtualWrite(V4, TEMP4);
delay(30);
akcja.process(); //timer Timers.h
if (Blynk.connected()) {
Blynk.run();
timer.run();
}
}
and this actually works?
You appear to be missing quite a lot of WiFi connection code that loops in a while or for loop until WiFi.status() != WL_CONNECTED
Your WiFi manager code seems to have abandoned the concept of connecting to WiFi altogether, so I can’t see how it could ever work, unless it’s using the WiFi credentials that the ESP stores in is NVR.
Even when you sort this out, your void loop is appalling and breaks all the rules of Blynk, so your sketch needs some serious restructuring.
I keep asking this, but have you looked at the Blynk Edgent example?