Hi, I have had a ESP8266 running during half a year with a DS18b20 and the Blynk function, which is great by the way. Now wanted to move to a new place and thus a new wifi ssd and pw, I reprogrammed it with the new SSD and Password and it worked... Then decided to resolder the connections to the DS18b20 since I had them originally on the breadboard connectors. But then it started "acting"... The serial connection pops up and down, then eventually blue screen in the Windows 7 I was using, then tested on a windows 11, same thing (not awaited to blue screen..). So Then I cant reprogram it, even with the "blink" program, since the arduino programmer doesnt get the "hook" on the serial port.... So then I went and bought a couple of new ESP8266, could program them with "blink" and they worked fine. Then I program each of them with the attached and nothing seems to happen. Then I connect the DS18b20 (black to ground, red to 5v, and yellow to D5) and the 4,7 between 5v and D5 cable. Even tried to old connection using the breadboard connectors.... same problem....
I now have 3 ESP8266 that I cant get to connect to any computer, they all create this "on and off" of the serial port.
Wanted to find a way to "reset" it hardware reset it, if that is possible, if it is the sketch that gets it to crash... But due to the "catch 22" I can get it connected to use any of the methods I have read about to reset it...
#define BLYNK_TEMPLATE_ID "TMPLxxxxxzhDZf"
#define BLYNK_DEVICE_NAME "Temperatur xxxxxst"
#define BLYNK_AUTH_TOKEN "tBH1avxxxxxxxCf9y1gLO0A91jxH"
// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial
#include <OneWire.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "BrxxxWiFi";
char pass[] = "xxxxxxxx";
BlynkTimer timer;
// This function is called every time the Virtual Pin 0 state changes
BLYNK_WRITE(V0)
{
// Set incoming value from pin V0 to a variable
int value = param.asInt();
// Update state
Blynk.virtualWrite(V1, value);
}
OneWire ds(D5); // on pin D4 (a 4.7K resistor is necessary)
WidgetLCD lcd(D7);
#define TRIGGERPIN D7
#define ECHOPIN D5
// This function is called every time the device is connected to the Blynk.Cloud
BLYNK_CONNECTED()
{
// Change Web Link Button message to "Congratulations!"
Blynk.setProperty(V3, "offImageUrl", "https://static-image.nyc3.cdn.digitaloceanspaces.com/general/fte/congratulations.png");
Blynk.setProperty(V3, "onImageUrl", "https://static-image.nyc3.cdn.digitaloceanspaces.com/general/fte/congratulations_pressed.png");
Blynk.setProperty(V3, "url", "https://docs.blynk.io/en/getting-started/what-do-i-need-to-blynk/how-quickstart-device-was-made");
}
// This function sends Arduino's uptime every second to Virtual Pin 2.
void myTimerEvent()
{
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V2, millis() / 1000);
}
void setup()
{
// Debug console
Serial.begin(115200);
pinMode(TRIGGERPIN, OUTPUT);
pinMode(ECHOPIN, INPUT);
Blynk.begin(auth, ssid, pass);
timer.setInterval(1000L, myTimerEvent);
}
void loop()
{
byte i;
byte present = 0;
byte type_s;
byte data[12];
byte addr[8];
float celsius, fahrenheit;
if ( !ds.search(addr))
{
ds.reset_search();
delay(250);
return;
}
if (OneWire::crc8(addr, 7) != addr[7])
{
Serial.println("CRC is not valid!");
return;
}
Serial.println();
// the first ROM byte indicates which chip
switch (addr[0])
{
case 0x10:
type_s = 1;
break;
case 0x28:
type_s = 0;
break;
case 0x22:
type_s = 0;
break;
default:
Serial.println("Device is not a DS18x20 family device.");
return;
}
ds.reset();
ds.select(addr);
ds.write(0x44, 1); // start conversion, with parasite power on at the end
delay(1000);
present = ds.reset();
ds.select(addr);
ds.write(0xBE); // Read Scratchpad
for ( i = 0; i < 9; i++)
{
data[i] = ds.read();
}
// Convert the data to actual temperature
int16_t raw = (data[1] << 8) | data[0];
if (type_s) {
raw = raw << 3; // 9 bit resolution default
if (data[7] == 0x10)
{
raw = (raw & 0xFFF0) + 12 - data[6];
}
}
else
{
byte cfg = (data[4] & 0x60);
if (cfg == 0x00) raw = raw & ~7; // 9 bit resolution, 93.75 ms
else if (cfg == 0x20) raw = raw & ~3; // 10 bit res, 187.5 ms
else if (cfg == 0x40) raw = raw & ~1; // 11 bit res, 375 ms
}
celsius = (float)raw / 16.0;
fahrenheit = celsius * 1.8 + 32.0;
Serial.print(" Temperature = ");
Serial.print(celsius);
Serial.print(" Celsius ");
lcd.print(V1, 1, celsius);
Blynk.virtualWrite (V7, celsius);
Blynk.run();
timer.run();
}


