Hej,
Actually there is…! I have two devices making strange thing (i think one of them maybe doing it therefore ,it works at the end of wifi coverage in my garden) ,but previous Serial monitor info was from second devise(esp8266) which works on another place and it has “# define BLYNK_PRINT serial” in the sketch. Sry, I didn’t say that.
#define BLYNK_TEMPLATE_ID "********"
#define BLYNK_DEVICE_NAME "Õhkküte"
#define BLYNK_AUTH_TOKEN "*********************"
#define BLYNK_FIRMWARE_VERSION "0.1.0"
#define BLYNK_PRINT Serial
#define APP_DEBUG
#define USE_NODE_MCU_BOARD
#define VENT D8 // ventilaatori juhtPin..hetkel relee selle taga..
//////////////////
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <AM2320.h>
// Garaazi I2C temp- ja niiskusandur AM2320b kasutab D1 ja D2 pinne ,kui pole määratud teisiti..Arvatavasti tuleb I2C tempandur ka ühendada D3 ja D4
#define ONE_WIRE_BUS D6 // Paneeli tempandurid // vcc ja anduri data otsa vahele 4.7k takisti
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
/////////////////
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 32
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
#define NUMFLAKES 10
#define LOGO_HEIGHT 16
#define LOGO_WIDTH 16
static const unsigned char PROGMEM logo_bmp[] =
{ 0b00000000, 0b11000000,
0b00000001, 0b11000000,
0b00000001, 0b11000000,
0b00000011, 0b11100000,
0b11110011, 0b11100000,
0b11111110, 0b11111000,
0b01111110, 0b11111111,
0b00110011, 0b10011111,
0b00011111, 0b11111100,
0b00001101, 0b01110000,
0b00011011, 0b10100000,
0b00111111, 0b11100000,
0b00111111, 0b11110000,
0b01111100, 0b11110000,
0b01110000, 0b01110000,
0b00000000, 0b00110000 };
String messages[] = {"Tere Hommikust"};
////////////////
//Andurite aadressid
DeviceAddress sensor1 = { 0x28, 0xFF, 0xA1, 0x4A, 0x30, 0x18, 0x2, 0xB5 };
DeviceAddress sensor2 = { 0x28, 0xAA, 0xF2, 0xE8, 0x17, 0x13, 0x2, 0xC8 };
DeviceAddress sensor3 = { 0x28, 0x65, 0x77, 0x77, 0x91, 0x10, 0x2, 0xF7 };
DeviceAddress sensor4 = { 0x28, 0x67, 0x7, 0x77, 0x91, 0x12, 0x2, 0x65 };
DeviceAddress sensor5 = { 0x28, 0xCA, 0x42, 0x77, 0x91, 0xB, 0x2, 0x16 };
AM2320 th(&Wire);
bool running = false; //läheb käima "false" olekus
float Celcius = 0;
char ssid[] = "******";
char pass[] = "*******";
BlynkTimer timer;
WidgetLED led(8);
WidgetTerminal terminal(V11);
//////////////////////////////////////////////
// float h = th.Humidity; // Garaazi Niiskus
// float t = th.cTemp; // Garaazi Temperatuur
// float t1 = (sensors.getTempC(sensor1)); // Andur 3m peal
// float t2 = (sensors.getTempC(sensor2)); // Andur 9m peal
// float t3 = (sensors.getTempC(sensor3)); // Andur 15m peal
// float t4 = (sensors.getTempC(sensor4)); // Andur 21m peal
// float t5 = (sensors.getTempC(sensor5)); // Andur 27m peal
//////////////////////////////////////////////
// Blynk appist vendi juhtimine
BLYNK_WRITE(V9)
{
switch (param.asInt()) {
case 1: {
digitalWrite(VENT, LOW); //Lülitab vendi sisse.
(running = true);
Serial.println("VENT APIST ON ");
break;
}
case 2: {
digitalWrite(VENT, HIGH); //Lülitab vendi välja.
(running = true);
Serial.println("VENT APIST OFF ");
break;
}
case 3: {
Serial.println("VENT APIST AUTOMAATNE"); //Lülitab vendi automaatse peale.
(running = false);
break;
}
}
}
void sendSensor()
{
Blynk.virtualWrite(V5, th.Humidity );
Blynk.virtualWrite(V6, th.cTemp );
Blynk.virtualWrite(V21, sensors.getTempC(sensor1) );
Blynk.virtualWrite(V22, sensors.getTempC(sensor2) );
Blynk.virtualWrite(V23, sensors.getTempC(sensor3) );
Blynk.virtualWrite(V24, sensors.getTempC(sensor4) );
Blynk.virtualWrite(V25, sensors.getTempC(sensor5) );
}
void prindimulle()
{
Serial.println("Kysin andmeid...");
sensors.requestTemperatures();
delay(200);
Serial.println("OLEMAS!");
Serial.print("Sensor 1: ");
Serial.print(sensors.getTempC(sensor1));
Serial.print("*C ");
Serial.println("Andur 3m peal");
delay(200);
Serial.print("Sensor 2: ");
Serial.print(sensors.getTempC(sensor2));
Serial.print("*C ");
Serial.println("Andur 9m peal");
delay(200);
Serial.print("Sensor 3: ");
Serial.print(sensors.getTempC(sensor3));
Serial.print("*C ");
Serial.println("Andur 15m peal");
delay(200);
Serial.print("Sensor 4: ");
Serial.print(sensors.getTempC(sensor4));
Serial.print("*C ");
Serial.println("Andur 21m peal");
delay(200);
Serial.print("Sensor 5: ");
Serial.print(sensors.getTempC(sensor5));
Serial.print("*C ");
Serial.println("Andur 27m peal");
delay(200);
Serial.print("Sensor 6: ");
Serial.print (th.cTemp);
Serial.print("*C ");
Serial.println("Andur Garaazis");
delay(200);
}
void saadaekraan()
{
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.print(F(" 3m temp = "));
display.print(sensors.getTempC(sensor1));
display.print(F(" C"));
display.display();
delay(1500);
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.print(F(" 9m temp = "));
display.print(sensors.getTempC(sensor2));
display.print(F(" C"));
display.display();
delay(1500);
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.print(F(" 15m temp = "));
display.print(sensors.getTempC(sensor3));
display.print(F(" C"));
display.display();
delay(1500);
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.print(F(" 21m temp = "));
display.print(sensors.getTempC(sensor4));
display.print(F(" C"));
display.display();
delay(1500);
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.print(F(" 27m temp = "));
display.print(sensors.getTempC(sensor5));
display.print(F(" C"));
display.display();
delay(1500);
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.print(F("Gar. temp = "));
display.print(th.cTemp);
display.print(F(" C"));
display.display();
display.clearDisplay();
delay(100);
}
void Sent_serial() {
String content = "";
char character;
while(Serial.available()) {
character = Serial.read();
content.concat(character);
}
if (content != "") {
Blynk.virtualWrite (V11, content);
}
}
void arvuta()
{
float h = th.Humidity; // Garaazi Niiskus
float t = th.cTemp; // Garaazi Temperatuur
float t4 = (sensors.getTempC(sensor4)); // Andur 21m peal
Serial.print("Running olek = ");
if (running == true) {
Serial.println("true");
}
else {
Serial.println ("false");
}
// t = garaazi temp
// t4 = paneeli temp 21m peal
// D0 = kontroll pin (kui akupinge üle 12,5v siis D0 = 0 ja kui akupinge alla 12,5v siis D0 = 1) - pole kasutuses hetkel enam(oli vana Blynk legasi ajal)
if (running == false && t4-t >= 15) {
digitalWrite (VENT, LOW); //kui blynk äpist on VENT väljalülitatud ja t1 > 24 ja t < 22 ja digitalRead(D0) == LOW,//
Serial.println("VENT ON "); //siis lülita VENT sisse ja pridi VENT sees//
}
else if (running == false && t4-t < 10 || running == false && t >= 27 || running == false && t4 <= t ) {
digitalWrite (VENT, HIGH);
Serial.println("VENT OFF");
}
if (digitalRead(D8) == LOW) { //Ventilaatori oleku ledmärgutuli blynk appis
led.on();
Serial.println("Led on");
}
else {
led.off();
Serial.println("Led off");
}
delay(300);
switch (th.Read()) {
case 2:
Serial.println(" CRC failed");
break;
case 1:
Serial.println(" Sensor offline");
break;
case 0:
Serial.print(" Niiskus = ");
Serial.print(th.Humidity);
Serial.println("%");
Serial.print(" Temperatuur = ");
Serial.print(th.cTemp);
Serial.println("*C");
Serial.println();
break;
}
}
//////////////////////////////////////////////////////////
void setup()
{
pinMode(VENT, OUTPUT);
digitalWrite (VENT, HIGH);
//Wire.pins(0,2); // SDA, SCL
Serial.begin(115200);
Serial.println("NodeMCU AM2320b 17.02.19 ");
Serial.println("DHTxx test!");
Wire.begin();
sensors.begin();
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
Serial.println("Tere hommikust Eestimaa :)");
Serial.println("Uus Blynk proov v:7.3");
if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;); // Don't proceed, loop forever
}
terminal.println(F("------terminal-------"));
terminal.println(F(" "));
delay(200);
terminal.println(F("Esp32 booting up"));
terminal.println(F("........."));
delay(100);
terminal.println(F("........"));
delay(100);
terminal.println(F("......."));
delay(100);
terminal.println(F("......"));
delay(100);
terminal.println(F("....."));
delay(100);
terminal.println(F("...."));
delay(100);
terminal.println(F("..."));
delay(100);
terminal.println(F(".."));
delay(100);
terminal.println(F(" Ready! "));
delay(100);
terminal.println(F(" "));
terminal.flush();
display.display();
delay(2000);
display.clearDisplay();
display.drawPixel(10, 10, SSD1306_WHITE);
display.display();
delay(2000);
timer.setInterval(1010L, sendSensor);
delay(100);
timer.setInterval(1028L, prindimulle);
delay(1500);
timer.setInterval(10000L, saadaekraan);
delay(500);
timer.setInterval(1033L, arvuta);
delay(400);
timer.setInterval(1013L, Sent_serial);
delay(200);
//digitalWrite (VENT, LOW);
}
////////////////////////////////////////////////////////////////
void loop()
{
Blynk.run();
timer.run();
}
´´´