msuphi
August 24, 2018, 11:05am
1
Hello to everyone.
Esp 8266= measures temperature with ds18b20 and oled installed.
Esp 8266 = relay module connected.
Esp 8266= BME 280 sensor connected. The external environment is measuring.
I see the 1rd (ds18b20) and 3rd(bme280) devices values in the phone application.
But How do I transfer the values from the 3rd device to the 1st oled screen on the 1st device?
Is this possible?`
I want to see all the values on the screen, depending on the 1st case.
Gunner
August 24, 2018, 11:09am
2
msuphi
August 24, 2018, 11:14am
3
the application allows only 1 bridge.
msuphi
August 24, 2018, 11:22am
4
3rd device codes:
#define BLYNK_PRINT Serial
#include <Wire.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
BlynkTimer timer;
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#define BME_SCK 14
#define BME_MISO 12
#define BME_MOSI 13
#define BME_CS 15
Adafruit_BME280 bme(BME_CS); // hardware SPI
char auth[] = "";
char ssid[] = "msd";
char pass[] = "CFPGawXk";
//BME280 bme; //Create an instance of the sensor
#define SEALEVELPRESSURE_HPA (1013.25)
float temp;
float hum;
float pres;
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
timer.setInterval(1000L, sending);
bme.begin();
}
void sending()
{
temp=bme.readTemperature ();
hum=bme.readHumidity();
pres=bme.readPressure() / 100.0F;
Serial.print(temp);
Serial.println(hum);
Serial.println(pres);
Blynk.virtualWrite(V10, temp);
Blynk.virtualWrite(V11, hum);
Blynk.virtualWrite(V12, pres);
}
void loop()
{
Blynk.run();
timer.run();
}
msuphi
August 24, 2018, 11:25am
5
connected to oled screen.
I need to add the values on the 3rd device here.
#include <Arduino.h>
#include <U8g2lib.h>
#ifdef U8X8_HAVE_HW_SPI
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif
U8G2_SSD1306_64X48_ER_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); // EastRising 0.66" OLED breakout board, Uno: A4=SDA, A5=SCL, 5V powered
#define BLYNK_PRINT Serial
#include <OneWire.h>
#include <DallasTemperature.h>
OneWire oneWire(2);
DallasTemperature DS18B20(&oneWire);
DeviceAddress DS18B20adres;
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
int offset;
int settemp;
int pozoffset;
int negoffset;
float temp;
float tempson;
WidgetBridge bridge1(V4);
WidgetLED led1(V5);
BlynkTimer timer;
char auth[] = ".................";
char ssid[] = "msd";
char pass[] = "..................";
BLYNK_WRITE(V9)
{
settemp = param.asInt(); // ayarlanan hedef sıcaklığı blynk den alıyoruz
//Blynk.virtualWrite(V8,settemp); // hedef sıcaklığı blynk e yazdırıyoruz.
}
BLYNK_WRITE(V1)
{
offset = param.asInt(); // sıcaklık düzeltme katsayısını app üzerinden alıyoruz
}
BLYNK_WRITE(V2)
{
pozoffset = param.asInt(); // pozitif konfor offsetini app den alıyoruz
}
BLYNK_WRITE(V3)
{
negoffset = param.asInt(); // negatif konfor offsetini app den alıyoruz.
}
//""""""""""""""""""6666666
void sending()
{
//if(DS18B20.getTempC(DS18B20adres)==0)
DS18B20.requestTemperatures();
temp = DS18B20.getTempC(DS18B20adres);
Serial.print("orgtemp");
Serial.print(temp);
Serial.println("c");
tempson=temp+(offset*0.1);
Serial.print("settemp");
Serial.print(settemp);
Serial.println("c");
delay(10);
Blynk.virtualWrite(V6, tempson); // sıcaklık değerini app e yazdırıyoruz.
Serial.print("tempson");
Serial.print(tempson);
Serial.println("c");
if(tempson>settemp+(pozoffset*0.1))
{
bridge1.digitalWrite(5, LOW);
led1.off();
}
if(tempson<settemp-(negoffset*0.1))
{
bridge1.digitalWrite(5, HIGH);
led1.on();
}
}
BLYNK_CONNECTED()
{
bridge1.setAuthToken("...............................");
Blynk.syncAll();
}
void setup()
{
u8g2.begin();
u8g2.clearBuffer();
DS18B20.begin();
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
DS18B20.getAddress(DS18B20adres, 0);
DS18B20.setResolution(DS18B20adres, 12);
timer.setInterval(1000L, sending);
}
void loop()
{
u8g2.firstPage();
do {
draw();
} while( u8g2.nextPage() );
delay(1000);
u8g2.firstPage();
do {
draw2();
} while( u8g2.nextPage() );
delay(1000);
Blynk.run();
timer.run();
}
//***********************************************
void draw(){
u8g2.clearBuffer();
u8g2.setFont(u8g2_font_timR18_tf);
u8g2.setCursor(0, 19);
u8g2.print("SET:");
u8g2.setCursor(20, 45);
u8g2.println(settemp);
u8g2.sendBuffer();
}
void draw2(){
u8g2.clearBuffer();
u8g2.setFont(u8g2_font_timR18_tf);
u8g2.setCursor(0, 19);
u8g2.print("ODA:");
u8g2.setCursor(5, 45);
u8g2.println(tempson);
u8g2.sendBuffer();
}
Gunner
August 24, 2018, 11:43am
6
??? I can and have used multiple bridges in a single sketch (linking to other sketches in other devices)
Also, please edit your posts to properly format the pasted code for viewing…
Hey, welcome to Blynk Community.
This is the best place to ask questions, leave feedback and share your ideas.
If this is the first time you hear about Blynk, check out our website www.blynk.cc and come back!
As the community is big (and growing), let’s agree on some basic rules.
Asking for help
Before creating a new topic and asking for help, please check if your question was already answered:
Use forum search function
You may want to check out:
Blynk Documentation
Blynk Wiki
Blynk Exa…
I don’t use bridges, but multiple bridges are certainly possible:
I want to control 4 devices from 1 using the bridge widget in a 1 master 3 slave configuration. So in the master sketch, I have defined
//Initiating Bridge Widget
WidgetBridge Bridge1(V0); //Relays
WidgetBridge Bridge2(V1); //Pumps 1-4
WidgetBridge Bridge3(V2); //Pumps 5-8
BLYNK_CONNECTED() {
Bridge1.setAuthToken("AUTH"); // Slave_Relays
Bridge2.setAuthToken("AUTH"); // Slave_Pumps 1-4
Bridge3.setAuthToken("AUTH"); // Slave_Pumps 5-8
//Bridge4.setAuthToken("AUTH"); // Slave_XXX
…
Pete.
msuphi
August 24, 2018, 2:27pm
8
BME 280 data bridge condition for printing on the LCD screen.
msuphi
August 24, 2018, 3:11pm
9
I will explain it like this.
V10, V11, V12, I need to print the data from the pins, oled screen.
I am already getting this data app.
float oled screen a = v10
float oled screen b = v11
lcdprint (oled screen a) .etc …
Like this.
My apprentice.
Codes are exemplary.
msuphi
August 24, 2018, 3:19pm
10
I got an idea.
Can I do it with BlynksyncVirtual.
float temp = Blynk.syncVirtual (V10);
…
write lcd, oled etc …
Art
March 5, 2019, 11:56pm
11
Hi Msuphi
I made with 4 device code using your 3rd devie code
Thanx a lot!!!
Art
take a look
#define BLYNK_PRINT Serial
#include <Wire.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
BlynkTimer timer;
#define BME_SCK 13
#define BME_MISO 12
#define BME_MOSI 11
#define BME_CS 15
char auth[] = “zzzz”;
char ssid[] = “xxxx”;
char pass[] = “yyyy”;
//BME280 bme; //Create an instance of the sensor
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME280 bme; // I2C
//Adafruit_BME280 bme(BME_CS); // hardware SPI
//Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK); // software SPI
unsigned long delayTime;
float temp;
float hum;
float pres;
float alt;
void setup()
{
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
timer.setInterval(1000L, sending);
bme.begin();
Serial.println(F(“BME280 test”));
if (!bme.begin(0x76)) {
Serial.println("Could not find a valid BME280 sensor, check wiring!");
while (1);
}
Serial.println("-- Default Test --");
Serial.println();
}
void sending()
{
temp=bme.readTemperature ();
hum=bme.readHumidity();
pres=bme.readPressure()/ 100.0F;
alt=(bme.readAltitude(SEALEVELPRESSURE_HPA));
Serial.print(temp);
Serial.println(hum);
Serial.println(pres);
Serial.println(alt);
Blynk.virtualWrite(V10, temp);
Blynk.virtualWrite(V11, hum);
Blynk.virtualWrite(V12, pres);
Blynk.virtualWrite(V13, alt);
}
void loop()
{
Blynk.run();
timer.run();
}