I have an Arduino Mega with the temperature sensors attached. I will be connecting it to Blynk via USB. The script below works fine and shows me the temperatures on the serial monitor every second…
#include <Wire.h>
#include <OneWire.h>
#include <DallasTemperature.h>
float tempC01, tempC02, tempC03;
//////////// Temperature sensor start ////////////
// Data wire is plugged into port 12 on the Arduino
#define ONE_WIRE_BUS_PIN 44
OneWire oneWire(ONE_WIRE_BUS_PIN);
DallasTemperature sensors(&oneWire);
DeviceAddress Probe01 = { 0x28, 0x5E, 0x72, 0xC5, 0x06, 0x00, 0x00, 0xA4 };
DeviceAddress Probe02 = { 0x28, 0x9F, 0x49, 0x2F, 0x06, 0x00, 0x00, 0xAA };
DeviceAddress Probe03 = { 0x28, 0x7A, 0xFB, 0xC4, 0x06, 0x00, 0x00, 0x79 };
//////////// Temperature sensor end ////////////
void setup()
{
Serial.begin(9600);
// Initialize the Temperature measurement library
sensors.begin();
// set the resolution to 10 bit (Can be 9 to 12 bits .. lower is faster)
sensors.setResolution(Probe01, 10);
sensors.setResolution(Probe02, 10);
sensors.setResolution(Probe03, 10);
}
void loop()
{
sensors.requestTemperatures();
tempC01 = sensors.getTempC(Probe01); // Tank
tempC02 = sensors.getTempC(Probe02); // Sump
tempC03 = sensors.getTempC(Probe03); // LEDS
Serial.print("Probe 1 (Tank) = ");
Serial.println(DallasTemperature::toFahrenheit(tempC01));
Serial.print("Probe 2 (Sump) = ");
Serial.println(DallasTemperature::toFahrenheit(tempC02));
Serial.print("Probe 3 (LEDS) = ");
Serial.println(DallasTemperature::toFahrenheit(tempC03));
Serial.println("----------------------");
delay(1000);
}
However this one below does not…
#define BLYNK_PRINT Serial1
#include <Wire.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <BlynkSimpleStream.h>
char auth[] = "65b59e****************************5f4166";
#define PIN_UPTIME V5
float tempC01, tempC02, tempC03;
//////////// Temperature sensor start ////////////
// Data wire is plugged into port 12 on the Arduino
#define ONE_WIRE_BUS_PIN 44
OneWire oneWire(ONE_WIRE_BUS_PIN);
DallasTemperature sensors(&oneWire);
DeviceAddress Probe01 = { 0x28, 0x5E, 0x72, 0xC5, 0x06, 0x00, 0x00, 0xA4 };
DeviceAddress Probe02 = { 0x28, 0x9F, 0x49, 0x2F, 0x06, 0x00, 0x00, 0xAA };
DeviceAddress Probe03 = { 0x28, 0x7A, 0xFB, 0xC4, 0x06, 0x00, 0x00, 0x79 };
//////////// Temperature sensor end ////////////
BLYNK_READ(PIN_UPTIME)
{
// This command writes Arduino's uptime in seconds to Virtual Pin (5)
Blynk.virtualWrite(PIN_UPTIME, millis() / 1000);
}
void setup()
{
Serial.begin(9600);
Serial1.begin(9600);
// Initialize the Temperature measurement library
sensors.begin();
// set the resolution to 10 bit (Can be 9 to 12 bits .. lower is faster)
sensors.setResolution(Probe01, 10);
sensors.setResolution(Probe02, 10);
sensors.setResolution(Probe03, 10);
Blynk.begin(Serial1, auth);
}
void loop()
{
Blynk.run();
sensors.requestTemperatures();
tempC01 = sensors.getTempC(Probe01); // Tank
tempC02 = sensors.getTempC(Probe02); // Sump
tempC03 = sensors.getTempC(Probe03); // LEDS
Serial.print("Probe 1 (Tank) = ");
Serial.println(DallasTemperature::toFahrenheit(tempC01));
Serial.print("Probe 2 (Sump) = ");
Serial.println(DallasTemperature::toFahrenheit(tempC02));
Serial.print("Probe 3 (LEDS) = ");
Serial.println(DallasTemperature::toFahrenheit(tempC03));
Serial.println("----------------------");
delay(1000);
}
I have narrowed it down to this line which is what stops the sensors from returning results in Serial monitor…
Blynk.begin(Serial1, auth);