Hello,
i have a script to read from 2 dallas sensors (18d20), i think its reading the data but the app only shows me high or low, how can i dsiplay the temp reading from 2 or more sensors?
im using both esp8266-12 or wemos d1 and have the same error
thank you
define BLYNK_PRINT Serial
include ESP8266WiFi.h>
include BlynkSimpleEsp8266.h>
include SimpleTimer.h>
include OneWire.h>
include DallasTemperature.h>
#define Pin 3 //One sensor connected on pin 3
#define Pin2 4 //One sensor connected on pin 4
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "ssid";
char pass[] = "pass";
char auth[] = "my access";
SimpleTimer timer;
OneWire ourWire(Pin);
OneWire ourWire2(Pin2);
DallasTemperature sensors(&ourWire);
DallasTemperature sensors2(&ourWire2);
float s1;
float s2;
void setup()
{
Serial.begin(115200);
delay(10);
Blynk.begin(auth, "ssid", "pass");
delay(10);
sensors.begin();
delay(10);
sensors2.begin();
delay(10);
sensors.setResolution(10);
delay(10);
sensors2.setResolution(10);
timer.setInterval(1000L, ReadTemp); // Will call the function to measure
// temperature every 1 second
}
void ReadTemp()
{
sensors.requestTemperatures();
delay(10);
s1 = sensors.getTempCByIndex(0);
delay(10);
sensors2.requestTemperatures();
delay(10);
s2 = sensors2.getTempCByIndex(0);
delay(10);
}
BLYNK_READ(V1)
{
Blynk.virtualWrite(V1, s1);
}
BLYNK_READ(V2)
{
Blynk.virtualWrite(V2, s2);
}
void loop()
{
Blynk.run();
timer.run();
}
@logico please edit your first post so we can actually read the sketch. Highlight the code and press the </> button and then check the include statements are legible.
What gave you the idea that you can use pin 3?
Pin 3 is the RX pin if I remember rightly. It can be used but obviously it messes up flashing etc so most people use regular pins.
Hello all and thanks for you help,
i update the code in the top so you can see
i will upload the pic for the 18b20 and i will try to use another pin address
ok, update.
first thank you all for your help, i do like blynk as IOT features, this product has a great potential !!
seems there is a problem using the webos D1 card with the code, switching back to ESP8266-12 solve the issue and now its working great…
still it is strange that on the same port on the wemos D1 it cant work.
and also the sensor work on 3.3V
ok, this is strange,
i took out the USB from the nodemcu ESP8266-12 and return it and the device isnt booting, after taking out the sensor from D4 and reset its loading, now when returning the Pin back to the original place i cant get any reading, rebooting the device giving the same error until disconnection the 18B20 pin.
i want to make sure
define Pin D3 //One sensor connected on pin 3
define Pin2 D4 //One sensor connected on pin 4
or i need to set it to:
define Pin 3 //One sensor connected on pin 3 #define Pin2 4 //One sensor connected on pin 4
define Pin 4 //One sensor connected on GPIO 4 which is physically D2 on a WeMos
define Pin2 5 //One sensor connected on GPIO 5 which is physically D1 on a WeMos
thank you very much
this daiagram is for the MINI version, its dff from the Retired old R1.
any way i have decided to go back to the old ESP-8266-12 device that works better
seems now i have an issue with the sensors that stop responding after a while