Gunner
October 18, 2017, 12:39pm
21
Please run this code (do not comment out anything else for now) and show your serial monitor output.
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <OneWire.h>;
#include <DallasTemperature.h>;
#define ONE_WIRE_BUS 15 // DS18B20 on arduino pin4 corresponds to GPI12 on physical board
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);
float temp;
//fim sensor temperatura
BlynkTimer timer;
void temperatura()
{
//inicio SENSOR TEMPERATURA
DS18B20.requestTemperatures();
temp = DS18B20.getTempCByIndex(0);
Serial.print("TEMPERATURA: ");
Serial.println(temp);
Serial.println(millis()/1000);
//Blynk.virtualWrite(V10, millis() / 1000);
}
void setup()
{
DS18B20.begin();
Serial.begin(115200);
Serial.println();
Serial.println();
//BLYNK
//Blynk.begin(auth, ssid, pass);
//Inicializa SENSOR TEMPERATURA
timer.setInterval(1000L, temperatura);
}
void loop()
{
//Blynk.run();
timer.run();
}
Gunner
October 18, 2017, 12:53pm
23
OK, good… it looks like is not the Blynk library so much as a possible issue when communicating over WiFi
You say you have tried ALL the pins (even the RX/TX?)
Can you try again, but with one of these pins - 16, 17, 18, 19
With this code - and make sure to change the pin number in this line as well: #define ONE_WIRE_BUS 15
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
char auth[] = "be36298205ca4bccb6d507c1ed6edc17";
char ssid[] = "REDE DS";
char pass[] = "1234554321";
#include <OneWire.h>
#include<DallasTemperature.h>
#define ONE_WIRE_BUS 15 // set the GPIO pin that the sensor is connected to
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);
float temp;
BlynkTimer timer;
void temperatura()
{
DS18B20.requestTemperatures();
temp = DS18B20.getTempCByIndex(0);
Serial.print("TEMPERATURA");
Serial.println(temp);
//Blynk.virtualWrite(V10, millis() / 1000);
}
void setup()
{
DS18B20.begin();
Serial.begin(115200);
//Blynk.begin(auth, ssid, pass);
timer.setInterval(1000L, temperatura);
}
void loop()
{
//Blynk.run();
timer.run();
}
Gunner
October 18, 2017, 12:57pm
24
OPPs… I meant try changing the pins but also while connecting to Blynk… so just uncomment the lines I have commented out.
Costas
October 18, 2017, 1:06pm
25
I found that yesterday, search engines are so useful and I’m guessing here, but there’s probably a whole bunch of web pages that even show you how to use search engines
It does not work on RX and TX, the readings are always -127º with BLYNK or without BLYNK.
Gunner
October 18, 2017, 1:08pm
27
I typed “How to search on Google” into Google once… I am still cleaning up the mess from the vortex
1 Like
Costas
October 18, 2017, 1:10pm
28
ESP32 certainly has some problems with pins and WiFi. Not entirely related but 8 of the analogue pins (ADC1) are OK with WiFi, the other 10 (ADC2) are not. A fix is supposedly imminent but just another reason I’m not a big fan of ESP32’s.
One day they will rock the world but still a long way to go until they are as reliable as the ESP8266.
Gunner
October 18, 2017, 1:10pm
29
I was being a bit sarcastic when mentioning those pins… as in you couldn’t have tested with ALL pins
Just try the last code, but with those other pins I mentioned… with Blynk running… they seem to be some of the most basic pins on the ESP32 lineup.
Gunner
October 18, 2017, 1:14pm
31
What pin where you using? Please try the others now. Thank you.
Gunner:
Você pode tentar novamente, mas com um desses pinos - 16, 17, 18, 19
I was able to use pin 16 because my esp-32 has an oled that uses some ports
I have another esp32 that does not have the oled but is at home.
Gunner
October 18, 2017, 1:18pm
33
Ahhh… the OLED is taking all the good pins
Try pin 5
Gunner
October 18, 2017, 1:27pm
36
OK, final test for me… need to sleep…
try this code on pin 5… every 10 seconds it will (should) disconnect from the server, read the temperature and reconnect.
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
char auth[] = "be36298205ca4bccb6d507c1ed6edc17";
char ssid[] = "REDE DS";
char pass[] = "1234554321";
#include <OneWire.h>
#include<DallasTemperature.h>
#define ONE_WIRE_BUS 5 // set the GPIO pin that the sensor is connected to
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);
float temp;
BlynkTimer timer;
void temperatura()
{
Blynk.disconnect();
delay(10);
DS18B20.requestTemperatures();
temp = DS18B20.getTempCByIndex(0);
Blynk.connect(5);
Serial.println("TEMPERATURA: ");
Serial.println(temp);
Blynk.virtualWrite(V10, millis() / 1000);
}
void setup()
{
DS18B20.begin();
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
timer.setInterval(10000L, temperatura);
}
void loop()
{
Blynk.run();
timer.run();
}
Gunner
October 18, 2017, 1:36pm
39
Well it was a shot… not sure what else to try, but I will think about it and check in later.