I have tried all that i can but i can’t manage to get the Zergba to work, it seems that it nevers sends the values, when i tell the esp8266 to print the values of Zergba it always tells me 0, i don’t know what else to do.
#define BLYNK_PRINT Serial
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <Ticker.h>
Adafruit_BME280 bme;
char auth[] = "1daa8c06625xxxxxxdd5cebdea61";
char ssid[] = "ASUS";
char pass[] = "*******";
Ticker timer;
const byte rmax = 500;
const byte gmax = 500;
const byte bmax = 500;
unsigned int Rpwm = 0;
unsigned int Gpwm = 0;
unsigned int Bpwm = 0;
int r;
int g;
int b;
byte i = 0;
bool A = false;
BLYNK_WRITE(V1) {
int r = param[0].asInt();
int g = param[1].asInt();
int b = param[2].asInt();
}
void setup()
{
Wire.begin(5, 4);
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
bme.begin(0x76);
bme.setSampling(Adafruit_BME280::MODE_FORCED,
Adafruit_BME280::SAMPLING_X1, // temperature
Adafruit_BME280::SAMPLING_X1, // pressure
Adafruit_BME280::SAMPLING_X1, // humidity
Adafruit_BME280::FILTER_OFF );
pinMode(12, OUTPUT);
pinMode(14, OUTPUT);
pinMode(15, OUTPUT);
timer.attach(20, ReadSensor);
//WidgetLCD lcd(V9);
delay(100);
}
void loop()
{
WidgetLCD lcd(V9);
Blynk.run();
Rpwm = map(r, 0, 1023, 0, rmax);
Gpwm = map(g, 0, 1023, 0, gmax);
Bpwm = map(b, 0, 1023, 0, bmax);
analogWrite(14, Rpwm);
analogWrite(12, Gpwm);
analogWrite(15, Bpwm);
if(A){
lcd.clear();
Blynk.virtualWrite(5, bme.readHumidity());
Serial.println(bme.readHumidity());
Blynk.virtualWrite(6, bme.readPressure());
Serial.println(bme.readPressure());
Blynk.virtualWrite(0, bme.readTemperature());
Serial.println(bme.readTemperature());
lcd.print(0, 0, "T: ");
lcd.print(3, 0, bme.readTemperature());
lcd.print(8, 0, "°C");
lcd.print(0, 1, "Pa: ");
lcd.print(4, 1, bme.readPressure());
A = !A;
}
}
void ReadSensor() {
bme.takeForcedMeasurement();
Serial.println(r);
Serial.println(g);
A = !A;
}