firmware BME/BMP280

Asica10
Posts: 63
Joined: Thu Feb 28, 2019 8:12 pm

Post

QLQ wrote: Sat Jun 22, 2019 11:57 pm I teraz @gba93 spać nie może. 😁🤣

Podłącz sobie jeszcze równolegle oled pod d1 i d2 bo kod to obsługuje :P
Screenshot_20190623-020208_Gallery.jpg
Witam,

Mówiąc że ten soft obsługuje OLED mówiłeś o sofcie z viewtopic.php?f=24&t=4136 ??

Pytam ponieważ po wgraniu oled nie uruchamia się, oraz w samym kodzie nie widze implementacji oleda.
QLQ
Posts: 2512
Joined: Sun Sep 03, 2017 9:13 am

Post

Asica10 wrote: Sat Jun 29, 2019 5:31 pm
QLQ wrote: Sat Jun 22, 2019 11:57 pm I teraz @gba93 spać nie może. 😁🤣

Podłącz sobie jeszcze równolegle oled pod d1 i d2 bo kod to obsługuje :P
Screenshot_20190623-020208_Gallery.jpg
Witam,

Mówiąc że ten soft obsługuje OLED mówiłeś o sofcie z viewtopic.php?f=24&t=4136 ??

Pytam ponieważ po wgraniu oled nie uruchamia się, oraz w samym kodzie nie widze implementacji oleda.
Nie w tamtym wątku.l nie ma oled. Jak wrócę podeślę
Tu
https://forum.supla.org/viewtopic.php ... 280#p44147
jak coś nie działa to włącz zasilanie.....
Asica10
Posts: 63
Joined: Thu Feb 28, 2019 8:12 pm

Post

Wgrsłem powyższy kod na Wemosie d1 mini i nie działa... oczywiście swoje dane wrzucone. Pozatym patrząc po kodzie obsługe wyświetlacza widze w kodzie deszczemierzu, a w kodzie stacji pogody juz nie...
QLQ
Posts: 2512
Joined: Sun Sep 03, 2017 9:13 am

Post

Asica10 wrote: Sun Jun 30, 2019 4:09 am Wgrsłem powyższy kod na Wemosie d1 mini i nie działa... oczywiście swoje dane wrzucone. Pozatym patrząc po kodzie obsługe wyświetlacza widze w kodzie deszczemierzu, a w kodzie stacji pogody juz nie...
Faktycznie podałem nie to.
Proszę tu jest na pewno: na czujniku odległości zrobiłem BH1750 - czujnik światła, BME jest normalnie, ale aby skompilować czujnik ciśnienia musisz mieć przerobioną blibliotekę SuplaDevice
SuplaDevice.rar

Code: Select all

                                              /**
   Supla.org NodeMCU WiFi minimal example
   Author: Programistyk - Kamil Kaminski <[email protected]>

   This example shows how to configure SuplaDevice for building for NodeMCU within Arduino IDE
*/
#define LIGHTSENSORPIN A0 //Ambient light sensor reading
#include <BH1750FVI.h>
#include <srpc.h>
#include <log.h>
#include <eh.h>
#include <proto.h>
#include <IEEE754tools.h>
// We define our own ethernet layer
#define SUPLADEVICE_CPP
#include <SuplaDevice.h>
#include <lck.h>

#include <WiFiClient.h>
#include <ESP8266WiFiType.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiScan.h>
#include <ESP8266WiFiMulti.h>
#include <WiFiServer.h>
#include <ESP8266WiFiGeneric.h>
#include <WiFiClientSecure.h>
#include <ESP8266WiFiAP.h>
#include <ESP8266WiFiSTA.h>
#include <WiFiUdp.h>
#include <Wire.h>
#include <OneWire.h>
#include <DallasTemperature.h>

#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#define OLED_RESET 0
Adafruit_SSD1306 display(OLED_RESET); // GPIO5 - SCL , GPIO4 -SDA

String light;


#define SEALEVELPRESSURE_HPA (1023.0)

Adafruit_BME280 bme; // I2C

#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2

BH1750FVI LightSensor(BH1750FVI::k_DevModeContLowRes);
#define LOGO32_GLCD_HEIGHT 32
#define LOGO32_GLCD_WIDTH  32
static const unsigned char PROGMEM temp_glcd_bmp[] =
{ // temp_home
  0x00, 0x03, 0xc0, 0x00, 0x00, 0x04, 0x20, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x50, 0x00, 
  0x00, 0x08, 0x50, 0x00, 0x00, 0x08, 0x50, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x09, 0x50, 0x00, 
  0x00, 0x08, 0xd0, 0x00, 0x00, 0x0b, 0x10, 0x00, 0x00, 0x0b, 0xd0, 0x00, 0x00, 0x0b, 0xd0, 0x00, 
  0x00, 0x0b, 0xd0, 0x00, 0x00, 0x0b, 0xd0, 0x00, 0x00, 0x0b, 0xd0, 0x00, 0x00, 0x0b, 0xd0, 0x00, 
  0x00, 0x0b, 0xd0, 0x00, 0x00, 0x0b, 0xd0, 0x00, 0x00, 0x0b, 0xd0, 0x00, 0x00, 0x0b, 0xd0, 0x00, 
  0x00, 0x0b, 0xd0, 0x00, 0x00, 0x0b, 0xd0, 0x00, 0x00, 0x0b, 0xd0, 0x00, 0x00, 0x17, 0xe8, 0x00, 
  0x00, 0x2f, 0xf4, 0x00, 0x00, 0x2f, 0x94, 0x00, 0x00, 0x2f, 0xb4, 0x00, 0x00, 0x2f, 0xf4, 0x00, 
  0x00, 0x07, 0xe0, 0x00, 0x00, 0x13, 0xc8, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x03, 0xc0, 0x00
};



static const unsigned char PROGMEM pressure_glcd_bmp[] =
{
  // 'pressure'
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 
  0x01, 0xc1, 0xc1, 0xf8, 0x03, 0xc3, 0xc1, 0xf8, 0x03, 0x83, 0x81, 0xf8, 0x03, 0x03, 0x00, 0x18, 
  0x07, 0x07, 0x00, 0x18, 0x07, 0x07, 0x00, 0xf8, 0x07, 0x07, 0x00, 0xf8, 0x07, 0x07, 0x00, 0xf8, 
  0x07, 0x07, 0x00, 0x18, 0x03, 0x03, 0x00, 0x18, 0x03, 0x83, 0x80, 0x18, 0x03, 0x83, 0x81, 0xf8, 
  0x03, 0x83, 0x81, 0xf8, 0x03, 0x83, 0x80, 0x18, 0x01, 0x81, 0x80, 0x18, 0x01, 0x81, 0x80, 0x18, 
  0x03, 0x83, 0x80, 0xf8, 0x03, 0x83, 0x80, 0xf8, 0x03, 0x83, 0x80, 0xf8, 0x13, 0x93, 0x80, 0x18, 
  0x1f, 0x1f, 0x00, 0x18, 0x1f, 0x1f, 0x01, 0xf8, 0x1e, 0x1e, 0x01, 0xf8, 0x1f, 0x1f, 0x01, 0xf8, 
  0x1f, 0x9f, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

static const unsigned char PROGMEM humidity_glcd_bmp[] =
{

  0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 
  0x00, 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x01, 0xce, 0x00, 0x00, 0x03, 0xcf, 0x00, 0x00, 
  0x03, 0x87, 0x00, 0x00, 0x07, 0x87, 0x80, 0x00, 0x07, 0x03, 0x80, 0x00, 0x0e, 0x01, 0xc0, 0x00, 
  0x1e, 0x01, 0xe0, 0x00, 0x1c, 0x00, 0xe0, 0x00, 0x38, 0x00, 0x70, 0x00, 0x78, 0x00, 0x78, 0x00, 
  0x70, 0x80, 0x38, 0x00, 0x61, 0x48, 0x18, 0x00, 0xe2, 0x48, 0x1c, 0x00, 0xe3, 0x50, 0x1c, 0x00, 
  0xe1, 0xa0, 0x1c, 0x00, 0xe0, 0x2a, 0x1c, 0x00, 0xe0, 0x52, 0x1c, 0x00, 0xe0, 0x92, 0x1c, 0x00, 
  0x60, 0x8c, 0x18, 0x00, 0x70, 0x00, 0x38, 0x00, 0x38, 0x00, 0x70, 0x00, 0x3c, 0x00, 0xf0, 0x00, 
  0x1e, 0x01, 0xe0, 0x00, 0x0f, 0xff, 0xc0, 0x00, 0x07, 0xff, 0x80, 0x00, 0x00, 0xfc, 0x00, 0x00
};

static const unsigned char PROGMEM rain_glcd_bmp[] = 
{
0x00,0x00,0x00,0x00, // ················
  0x00,0x00,0x00,0x00, // ················
  0x00,0x00,0x00,0x00, // ················
  0x00,0x00,0x00,0x00, // ················
  0x00,0x00,0x00,0x00, // ················
  0x00,0x00,0x00,0x00, // ················
  0x00,0x00,0x00,0x00, // ················
  0x00,0x00,0x00,0x00, // ················
  0x00,0x00,0x00,0x00, // ················
  0x00,0x00,0x00,0x00, // ················
  0x00,0xF3,0xE0,0x00, // ····██·██▌······
  0x01,0x8E,0x18,0x00, // ···▐▌·█▌·▐▌·····
  0x03,0x0C,0x08,0x00, // ···█··█···▌·····
  0x04,0x38,0x0F,0x00, // ··▐··█▌···██····
  0x08,0x28,0x11,0x80, // ··▌··▌▌··▐·▐▌···
  0x10,0x40,0x00,0xC0, // ·▐··▐·······█···
  0x10,0x80,0x00,0x40, // ·▐··▌·······▐···
  0x0F,0x00,0x00,0x40, // ··██········▐···
  0x01,0x00,0x00,0x40, // ···▐········▐···
  0x01,0x00,0x00,0x80, // ···▐········▌···
  0x00,0xFF,0xFF,0x00, // ····████████····
  0x00,0x14,0x96,0x00, // ·····▐▐·▌▐▐▌····
  0x00,0x24,0xA4,0x00, // ·····▌▐·▌▌▐·····
  0x00,0x21,0x0C,0x00, // ·····▌·▐··█·····
  0x00,0x40,0x08,0x00, // ····▐·····▌·····
  0x00,0x10,0x80,0x00, // ·····▐··▌·······
  0x00,0x10,0x80,0x00, // ·····▐··▌·······
  0x00,0x00,0x00,0x00, // ················
  0x00,0x00,0x00,0x00, // ················
  0x00,0x00,0x00,0x00, // ················
  0x00,0x00,0x00,0x00, // ················
  0x00,0x00,0x00,0x00  // ················
};

static const unsigned char PROGMEM lux_glcd_bmp[] =
{


0x00,0x01,0xC0,0x00, // ·······▐█·······
  0x00,0x01,0xC0,0x00, // ·······▐█·······
  0x00,0xC1,0xC1,0x80, // ····█··▐█··▐▌···
  0x00,0xE1,0xC3,0x80, // ····█▌·▐█··█▌···
  0x00,0x71,0xC7,0x00, // ····▐█·▐█·▐█····
  0x00,0x70,0x87,0x00, // ····▐█··▌·▐█····
  0x00,0x30,0x06,0x00, // ·····█····▐▌····
  0x18,0x07,0xF0,0x0C, // ·▐▌···▐███····█·
  0x3E,0x1F,0xF8,0x3C, // ·██▌·▐████▌··██·
  0x1F,0x3F,0x7E,0x78, // ·▐██·███▐██▌▐█▌·
  0x07,0x78,0x0E,0x70, // ··▐█▐█▌···█▌▐█··
  0x00,0x70,0x07,0x00, // ····▐█····▐█····
  0x00,0xE0,0x03,0x80, // ····█▌·····█▌···
  0x00,0xE0,0x03,0x80, // ····█▌·····█▌···
  0x7C,0xC0,0x03,0x9F, // ▐██·█······█▌▐██
  0xFE,0xC0,0x01,0xBF, // ███▌█······▐▌███
  0x7C,0xC0,0x01,0x9F, // ▐██·█······▐▌▐██
  0x00,0xE0,0x03,0x80, // ····█▌·····█▌···
  0x00,0xE0,0x03,0x80, // ····█▌·····█▌···
  0x00,0x70,0x07,0x00, // ····▐█····▐█····
  0x07,0x78,0x0F,0x70, // ··▐█▐█▌···██▐█··
  0x0F,0x3E,0x3E,0x78, // ··██·██▌·██▌▐█▌·
  0x1E,0x1F,0xFC,0x3C, // ·▐█▌·▐█████··██·
  0x18,0x07,0xF0,0x0C, // ·▐▌···▐███····█·
  0x00,0x30,0x06,0x00, // ·····█····▐▌····
  0x00,0x70,0x87,0x00, // ····▐█··▌·▐█····
  0x00,0x71,0xC7,0x00, // ····▐█·▐█·▐█····
  0x00,0xE1,0xC3,0x80, // ····█▌·▐█··█▌···
  0x00,0xC1,0xC3,0x80, // ····█··▐█··█▌···
  0x00,0x01,0xC1,0x00, // ·······▐█··▐····
  0x00,0x01,0xC0,0x00, // ·······▐█·······
  0x00,0x00,0x80,0x00  // ········▌·······
};

static const unsigned char PROGMEM logo32_glcd_bmp[] =
{
  // 'logo SUPLA'
  0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x03, 0xf8, 0x00, 0x00, 0x07, 0xfc, 0x00, 0x00,
  0x0e, 0x0e, 0x00, 0x00, 0x0c, 0x06, 0x00, 0x00, 0x1c, 0x03, 0x00, 0x00, 0x1c, 0x03, 0x00, 0x00,
  0x1c, 0x03, 0x00, 0x00, 0x0c, 0x07, 0x00, 0x00, 0x0e, 0x0f, 0x80, 0x00, 0x07, 0xfc, 0xe0, 0x00,
  0x03, 0xf8, 0x30, 0x00, 0x00, 0xf0, 0x0d, 0xe0, 0x00, 0x10, 0x07, 0x30, 0x00, 0x18, 0x02, 0x10,
  0x00, 0x18, 0x06, 0x18, 0x00, 0x08, 0x02, 0x10, 0x00, 0x08, 0x03, 0xf0, 0x00, 0x0c, 0x07, 0xc0,
  0x00, 0x04, 0x0c, 0x00, 0x00, 0x04, 0x08, 0x00, 0x00, 0x04, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00,
  0x00, 0x03, 0xc0, 0x00, 0x00, 0x04, 0x40, 0x00, 0x00, 0x0c, 0x20, 0x00, 0x00, 0x0c, 0x20, 0x00,
  0x00, 0x04, 0x40, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const unsigned char PROGMEM ASL_glcd_bmp[] =
{
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 
  0x00, 0x00, 0x60, 0x00, 0x00, 0x08, 0x21, 0x00, 0x00, 0x0c, 0x03, 0x00, 0x00, 0x00, 0x62, 0x00, 
  0x00, 0x1f, 0xf8, 0x00, 0x00, 0x3f, 0x0c, 0x00, 0x00, 0x61, 0x84, 0x00, 0x00, 0xc0, 0xc4, 0xe0, 
  0x01, 0xc0, 0xf4, 0x00, 0x03, 0x00, 0x1c, 0x00, 0x06, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x0c, 0x00, 
  0x06, 0x10, 0xcd, 0x00, 0x03, 0x10, 0x99, 0x00, 0x01, 0x84, 0x30, 0x00, 0x00, 0x25, 0x00, 0x00, 
  0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 
  };

char* Message[] = {"This is string 1",
                   "Already initialized",
                   "Cb not assigned",
                   "Invalid GUID",
                   "Unknown server address",
                   "Unknow location ID",
                   "Initialized",
                   "Channel limit exceeded",
                   "Rozlaczony",
                   "Rejstracja w toku",
                   "Iterate fail",
                   "Protocol version error",
                   "Bad credentials",
                   "Temporarily unawaliable",
                   "Location conflict",
                   "Channel conflict",
                   "Polaczony i gotowy",
                   "Device is diasbled",
                   "Location is disabled",
                   "Device limit execeeded"
                  };



#if (SSD1306_LCDHEIGHT != 64)
//#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif

// ***** logowanie WiFi ********************************************************************************
WiFiClient client;

// Setup Supla connection
const char* ssid     = "xxx";
const char* password = "kxxx79";

char str[10];
char StatCommStr[25];
int StatCommInt;
byte Icon;
byte FiveSek;




//// ******* BME280 Temperatura i wilgotnosc *********************************

void get_temperature_and_humidity (int channelNumber, double *temp, double *humidity){
  
    *temp = bme.readTemperature();
    Serial.print("Temperature = ");
    Serial.print(bme.readTemperature());
    Serial.println(" *C");

  
    *humidity = bme.readHumidity();
    Serial.print("Humidity = ");
    Serial.print(bme.readHumidity());               // wyremowane dla BMP280   
    Serial.println(" %");
    if ( isnan(*temp) || isnan(*humidity) ) {
      *temp = -275;
      *humidity = -1;
    }

  }
///***********DESZCZ*******************************************************
double get_rain(int channelNumber, double rain) {
   
 rain = 10;
    Serial.print("Rain = ");
    Serial.print(rain);
    Serial.println(" mm");
   return  rain; 

   
}



//// ******* Ciśnienie *****************************************************  
double get_pressure(int channelNumber, double pressure) {
   
 pressure = bme.readPressure() / 100.0F;
    Serial.print("Pressure = ");
    Serial.print(bme.readPressure()/100);
    Serial.println(" hPa");
   return  pressure; 

   
}

////******* Natężenie zrobione obsługą czujnika odległości

double get_distance(int channelNumber, double t) {

 // float lux = analogRead(LIGHTSENSORPIN);             //TEMT6000
   double lux = LightSensor.GetLightIntensity();     //BH1750
    t = abs(lux);
    Serial.print("Natezenie swiatla = ");
    Serial.print(LightSensor.GetLightIntensity());
    delay(1250);
    return t;

}


void timer0_ISR (void) {
  FiveSek++;
  if (FiveSek==5) {
    FiveSek=0;
    Icon++;
    if (Icon==6) Icon=1;
  }
  timer0_write(ESP.getCycleCount() + 80000000L); // 80MHz == 1sec 
}

//// ******* Funkcja główna *********************************************************************************
void setup() {
  
    Serial.begin(9600); //BH1750
  //pinMode(LIGHTSENSORPIN, INPUT);   // dodany czujnik natężenia 
   LightSensor.begin();  
   
  noInterrupts();
  timer0_isr_init();
  timer0_attachInterrupt(timer0_ISR);
  timer0_write(ESP.getCycleCount() + 80000000L); // 80MHz == 1sec
  interrupts();
 
  if (!bme.begin(0x76)) {
    Serial.println("Could not find a valid BME280 sensor, check wiring!");
    while (1);
    }

  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3C (for the 128x64)
 
  Icon = 0;

  // Clear the buffer.
  display.clearDisplay();

  // text display tests
  display.setTextSize(3);
  display.setTextColor(WHITE);
  display.setRotation(2);
  display.setCursor(30, 25);
  display.print("SUPLA");
  drawbitmap(logo32_glcd_bmp, LOGO32_GLCD_HEIGHT, LOGO32_GLCD_WIDTH);
  display.display();





  // Replace the falowing GUID
char GUID[SUPLA_GUID_SIZE] = {0x8B,0x4A,0x5B,0xB5,0x6B,0x68,0x76,0x5B,0xF5,0xEA,0x9A,0x8C,0x73,0xC6,0x38,0x1D};

  //  GUID that you can retrieve from https://www.supla.org/arduino/get-guid

  // Ethernet MAC address
  uint8_t mac[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

  /*
     Having your device already registered at cloud.supla.org,
     you want to change CHANNEL sequence or remove any of them,
     then you must also remove the device itself from cloud.supla.org.
     Otherwise you will get "Channel conflict!" error.
  */
    
          // CHANNEL0 
            SuplaDevice.addRainSensor(); //deszczu czujnik
            SuplaDevice.addDHT22(); // ten objekt jest tylko po to aby w aplikacji wyświetlic temp i wilgotnosc
	          SuplaDevice.addDistanceSensor(); // ten obiekt wyswietla natezenie niestety bez jednostek (LUX)
	          SuplaDevice.addPressureSensor();  // cisnienie
 
     

  

  SuplaDevice.setName("Your_Name_");
  SuplaDevice.setStatusFuncImpl(&status_func);

  SuplaDevice.begin(GUID,              // Global Unique Identifier
                    mac,               // Ethernet MAC address
                    "svr5.supla.org",  // SUPLA server address
                    81,                 // Location ID
                    "sdfsd");               // Location Password

}


// ***********************************************************************************************************
void loop() {
  SuplaDevice.iterate();
  DisplayTemp();

}

// ****   Obsługa OLED    ****************************************************************************************************

void DisplayTemp() {

   
double Light_Intensity = LightSensor.GetLightIntensity();
int rain=0.01;
 
  display.clearDisplay();
  display.setTextSize(3);
  display.setTextColor(WHITE);
  display.setRotation(2);
  display.setCursor(45, 25);  
 
  switch (Icon) {
      case 1:
        display.setTextSize(3);
        display.setCursor(45, 25);  
        display.print(bme.readTemperature(), 0);
        display.print((char)247);
        display.println("C");
        drawbitmap(temp_glcd_bmp, LOGO32_GLCD_HEIGHT, LOGO32_GLCD_WIDTH);
        
        break;
      case 2:
       display.setTextSize(3);
        display.setCursor(45, 25);  
       display.print(bme.readHumidity(), 0);
        display.println("%");
        drawbitmap(humidity_glcd_bmp, LOGO32_GLCD_HEIGHT, LOGO32_GLCD_WIDTH);
        break;
        
      case 3:
         display.setTextSize(2);
         display.setCursor(32, 25);  
        display.print(bme.readPressure() / 100.0F, 0);
        display.println(" hPa");
        drawbitmap(pressure_glcd_bmp, LOGO32_GLCD_HEIGHT, LOGO32_GLCD_WIDTH);
        break;
        
       case 4:
       display.setTextSize(2);
        display.setCursor(45, 25);  
        display.print(Light_Intensity, 0);
        display.println(" Lux");
        drawbitmap(lux_glcd_bmp, LOGO32_GLCD_HEIGHT, LOGO32_GLCD_WIDTH);           
        break;
      
        case 5:
        display.setTextSize(2);
        display.setCursor(19, 29);  
       // display.print(rain, 0);
        display.println("0,01 l/m2");
        drawbitmap(rain_glcd_bmp, LOGO32_GLCD_HEIGHT, LOGO32_GLCD_WIDTH);           
        break;
        
     /* case 5:
        display.setTextSize(2);
        display.setCursor(45, 25);  
        display.print(bme.readAltitude(SEALEVELPRESSURE_HPA), 0);
        display.println(" npm");
        drawbitmap(ASL_glcd_bmp, LOGO32_GLCD_HEIGHT, LOGO32_GLCD_WIDTH);
        break;*/
    

//---------------------        
  };
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0, 55);
  display.print(Message[StatCommInt - 1]);
  display.display();
  display.display();

}; //DisplayTemp

void drawbitmap(const uint8_t *bitmap, uint8_t w, uint8_t h) {
  uint8_t icons[NUMFLAKES][3];

  display.drawBitmap(0, 0, bitmap, w, h, WHITE);
} //drawbitmap


// Supla.org ethernet layer
int supla_arduino_tcp_read(void *buf, int count) {
  _supla_int_t size = client.available();

  if ( size > 0 ) {
    if ( size > count ) size = count;
    return client.read((uint8_t *)buf, size);
  };

  return -1;
};

int supla_arduino_tcp_write(void *buf, int count) {
  return client.write((const uint8_t *)buf, count);
};

bool supla_arduino_svr_connect(const char *server, int port) {
  return client.connect(server, 2015);
}

bool supla_arduino_svr_connected(void) {
  return client.connected();
}

void supla_arduino_svr_disconnect(void) {
  client.stop();
}

void supla_arduino_eth_setup(uint8_t mac[6], IPAddress *ip) {

  // Serial.println("WiFi init");
  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
        Serial.print(".");
  }

 // Serial.print("\nlocalIP: ");
 // Serial.println(WiFi.localIP());
  //Serial.print("subnetMask: ");
 // Serial.println(WiFi.subnetMask());
  //Serial.print("gatewayIP: ");
  //Serial.println(WiFi.gatewayIP());
}

SuplaDeviceCallbacks supla_arduino_get_callbacks(void) {
  SuplaDeviceCallbacks cb;

  cb.tcp_read = &supla_arduino_tcp_read;
  cb.tcp_write = &supla_arduino_tcp_write;
  cb.eth_setup = &supla_arduino_eth_setup;
  cb.svr_connected = &supla_arduino_svr_connected;
  cb.svr_connect = &supla_arduino_svr_connect;
  cb.svr_disconnect = &supla_arduino_svr_disconnect;
  cb.get_rain = get_rain;
  cb.get_temperature_and_humidity = get_temperature_and_humidity;
  cb.get_pressure = get_pressure; 
  cb.get_temperature = NULL;
  cb.get_rgbw_value = NULL;
  cb.set_rgbw_value = NULL;
  cb.get_distance= get_distance;

  return cb;
}



void status_func(int status, const char *msg) {
  Serial.print("Status : ");
  Serial.print(status);
  StatCommInt = status;
  Serial.print(" - ");
  Serial.println(Message[StatCommInt - 1]);
  display.fillRect(0, 55, 128, 65, BLACK);

  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setRotation(2);
  display.setCursor(0, 55);
  display.print(Message[StatCommInt - 1]);
  display.display();

}

You do not have the required permissions to view the files attached to this post.
jak coś nie działa to włącz zasilanie.....
Asica10
Posts: 63
Joined: Thu Feb 28, 2019 8:12 pm

Post

Podmieniam biblioteke wpisuje swoje dane, ale niestety do Supli się nie łączy ( do routera esp też)...


Próbuje na tą chwile połączyć kod z postu powyżej (obsługa OLED) do softu z viewtopic.php?f=24&t=4136

Problem mam taki że na wyświetlaczu wyświetla się tylko to co jest w void setup.... a z void loop i z funkcji już nie. Siedze nad tym kilka godzin i nie mam pomysłu co jest nie tak.
QLQ
Posts: 2512
Joined: Sun Sep 03, 2017 9:13 am

Post

Asica10 wrote: Sun Jun 30, 2019 1:14 pm Podmieniam biblioteke wpisuje swoje dane, ale niestety do Supli się nie łączy ( do routera esp też)...


Próbuje na tą chwile połączyć kod z postu powyżej (obsługa OLED) do softu z viewtopic.php?f=24&t=4136

Problem mam taki że na wyświetlaczu wyświetla się tylko to co jest w void setup.... a z void loop i z funkcji już nie. Siedze nad tym kilka godzin i nie mam pomysłu co jest nie tak.
Wygeneruj sobie nowe ID bo przez to się nie łączy. Link w kodzie.
Druga rzecz że jak źle podlaczysz bme to też się nie będzie łączyć dopóki nie będzie widział BME.

Code: Select all

char GUID[SUPLA_GUID_SIZE] = {0x8B,0x4A,0x5B,0xB5,0x6B,0x68,0x76,0x5B,0xF5,0xEA,0x9A,0x8C,0x73,0xC6,0x38,0x1D};

  //  GUID that you can retrieve from https://www.supla.org/arduino/get-guid
jak coś nie działa to włącz zasilanie.....
Asica10
Posts: 63
Joined: Thu Feb 28, 2019 8:12 pm

Post

Generowałem nowe ID. BME jest podlaczone dobrze bo na innym sofcie który nie obługuje OLEDA nie mam z nim żadnego problemu.

Nawet jak by dane były złe do supli to do router powinno zalogować się nowe urządzenia, a to się niestety nie dzieje.

Robiłem także hotspota z telefonu bo myślałem że spacje w nazwie sieci mogły robić problem, ale dalej to samo...Tak mam na każdym sofcie gdzie ręcznie podaje się dane do logowania.
User avatar
makrz
Posts: 401
Joined: Tue Nov 27, 2018 1:43 pm
Location: Opole

Post

Asica10 wrote: Sun Jun 30, 2019 2:33 pm Generowałem nowe ID. BME jest podlaczone dobrze bo na innym sofcie który nie obługuje OLEDA nie mam z nim żadnego problemu.

Nawet jak by dane były złe do supli to do router powinno zalogować się nowe urządzenia, a to się niestety nie dzieje.

Robiłem także hotspota z telefonu bo myślałem że spacje w nazwie sieci mogły robić problem, ale dalej to samo...Tak mam na każdym sofcie gdzie ręcznie podaje się dane do logowania.
Włącz monitor portu szeregowego w arduino (prędkość chyba 9600) i będziesz wiedział co jest nie tak. To, że BME na innym sofcie działa to nic nie znaczy.
QLQ
Posts: 2512
Joined: Sun Sep 03, 2017 9:13 am

Post

Asica10 wrote: Sun Jun 30, 2019 2:33 pm Generowałem nowe ID. BME jest podlaczone dobrze bo na innym sofcie który nie obługuje OLEDA nie mam z nim żadnego problemu.

Nawet jak by dane były złe do supli to do router powinno zalogować się nowe urządzenia, a to się niestety nie dzieje.

Robiłem także hotspota z telefonu bo myślałem że spacje w nazwie sieci mogły robić problem, ale dalej to samo...Tak mam na każdym sofcie gdzie ręcznie podaje się dane do logowania.
Faktycznie w tym kodzie sie coś urwało.
Tu sprawdzony na gorąco - działa:

Code: Select all

/**
   Supla.org NodeMCU WiFi minimal example
   Author: Programistyk - Kamil Kaminski <[email protected]>

   This example shows how to configure SuplaDevice for building for NodeMCU within Arduino IDE
*/


#include <srpc.h>
#include <log.h>
#include <eh.h>
#include <proto.h>
#include <IEEE754tools.h>
// We define our own ethernet layer
#define SUPLADEVICE_CPP
#include <SuplaDevice.h>
#include <lck.h>

#include <WiFiClient.h>
#include <ESP8266WiFiType.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiScan.h>
#include <ESP8266WiFiMulti.h>
#include <WiFiServer.h>
#include <ESP8266WiFiGeneric.h>
#include <WiFiClientSecure.h>
#include <ESP8266WiFiAP.h>
#include <ESP8266WiFiSTA.h>
#include <WiFiUdp.h>
#include <Wire.h>

#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

#define OLED_RESET 0
Adafruit_SSD1306 display(OLED_RESET); // GPIO5 - SCL , GPIO4 -SDA

#define SEALEVELPRESSURE_HPA (1023.0)

Adafruit_BME280 bme; // I2C

#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2


#define LOGO32_GLCD_HEIGHT 32
#define LOGO32_GLCD_WIDTH  32
static const unsigned char PROGMEM temp_glcd_bmp[] =
{ // temp_home
  0x00, 0x03, 0xc0, 0x00, 0x00, 0x04, 0x20, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x50, 0x00, 
  0x00, 0x08, 0x50, 0x00, 0x00, 0x08, 0x50, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x09, 0x50, 0x00, 
  0x00, 0x08, 0xd0, 0x00, 0x00, 0x0b, 0x10, 0x00, 0x00, 0x0b, 0xd0, 0x00, 0x00, 0x0b, 0xd0, 0x00, 
  0x00, 0x0b, 0xd0, 0x00, 0x00, 0x0b, 0xd0, 0x00, 0x00, 0x0b, 0xd0, 0x00, 0x00, 0x0b, 0xd0, 0x00, 
  0x00, 0x0b, 0xd0, 0x00, 0x00, 0x0b, 0xd0, 0x00, 0x00, 0x0b, 0xd0, 0x00, 0x00, 0x0b, 0xd0, 0x00, 
  0x00, 0x0b, 0xd0, 0x00, 0x00, 0x0b, 0xd0, 0x00, 0x00, 0x0b, 0xd0, 0x00, 0x00, 0x17, 0xe8, 0x00, 
  0x00, 0x2f, 0xf4, 0x00, 0x00, 0x2f, 0x94, 0x00, 0x00, 0x2f, 0xb4, 0x00, 0x00, 0x2f, 0xf4, 0x00, 
  0x00, 0x07, 0xe0, 0x00, 0x00, 0x13, 0xc8, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x03, 0xc0, 0x00
};



static const unsigned char PROGMEM pressure_glcd_bmp[] =
{
  // 'pressure'
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 
  0x01, 0xc1, 0xc1, 0xf8, 0x03, 0xc3, 0xc1, 0xf8, 0x03, 0x83, 0x81, 0xf8, 0x03, 0x03, 0x00, 0x18, 
  0x07, 0x07, 0x00, 0x18, 0x07, 0x07, 0x00, 0xf8, 0x07, 0x07, 0x00, 0xf8, 0x07, 0x07, 0x00, 0xf8, 
  0x07, 0x07, 0x00, 0x18, 0x03, 0x03, 0x00, 0x18, 0x03, 0x83, 0x80, 0x18, 0x03, 0x83, 0x81, 0xf8, 
  0x03, 0x83, 0x81, 0xf8, 0x03, 0x83, 0x80, 0x18, 0x01, 0x81, 0x80, 0x18, 0x01, 0x81, 0x80, 0x18, 
  0x03, 0x83, 0x80, 0xf8, 0x03, 0x83, 0x80, 0xf8, 0x03, 0x83, 0x80, 0xf8, 0x13, 0x93, 0x80, 0x18, 
  0x1f, 0x1f, 0x00, 0x18, 0x1f, 0x1f, 0x01, 0xf8, 0x1e, 0x1e, 0x01, 0xf8, 0x1f, 0x1f, 0x01, 0xf8, 
  0x1f, 0x9f, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

static const unsigned char PROGMEM humidity_glcd_bmp[] =
{

  0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 
  0x00, 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x01, 0xce, 0x00, 0x00, 0x03, 0xcf, 0x00, 0x00, 
  0x03, 0x87, 0x00, 0x00, 0x07, 0x87, 0x80, 0x00, 0x07, 0x03, 0x80, 0x00, 0x0e, 0x01, 0xc0, 0x00, 
  0x1e, 0x01, 0xe0, 0x00, 0x1c, 0x00, 0xe0, 0x00, 0x38, 0x00, 0x70, 0x00, 0x78, 0x00, 0x78, 0x00, 
  0x70, 0x80, 0x38, 0x00, 0x61, 0x48, 0x18, 0x00, 0xe2, 0x48, 0x1c, 0x00, 0xe3, 0x50, 0x1c, 0x00, 
  0xe1, 0xa0, 0x1c, 0x00, 0xe0, 0x2a, 0x1c, 0x00, 0xe0, 0x52, 0x1c, 0x00, 0xe0, 0x92, 0x1c, 0x00, 
  0x60, 0x8c, 0x18, 0x00, 0x70, 0x00, 0x38, 0x00, 0x38, 0x00, 0x70, 0x00, 0x3c, 0x00, 0xf0, 0x00, 
  0x1e, 0x01, 0xe0, 0x00, 0x0f, 0xff, 0xc0, 0x00, 0x07, 0xff, 0x80, 0x00, 0x00, 0xfc, 0x00, 0x00

  
};
static const unsigned char PROGMEM logo32_glcd_bmp[] =
{
  // 'logo SUPLA'
  0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x03, 0xf8, 0x00, 0x00, 0x07, 0xfc, 0x00, 0x00,
  0x0e, 0x0e, 0x00, 0x00, 0x0c, 0x06, 0x00, 0x00, 0x1c, 0x03, 0x00, 0x00, 0x1c, 0x03, 0x00, 0x00,
  0x1c, 0x03, 0x00, 0x00, 0x0c, 0x07, 0x00, 0x00, 0x0e, 0x0f, 0x80, 0x00, 0x07, 0xfc, 0xe0, 0x00,
  0x03, 0xf8, 0x30, 0x00, 0x00, 0xf0, 0x0d, 0xe0, 0x00, 0x10, 0x07, 0x30, 0x00, 0x18, 0x02, 0x10,
  0x00, 0x18, 0x06, 0x18, 0x00, 0x08, 0x02, 0x10, 0x00, 0x08, 0x03, 0xf0, 0x00, 0x0c, 0x07, 0xc0,
  0x00, 0x04, 0x0c, 0x00, 0x00, 0x04, 0x08, 0x00, 0x00, 0x04, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00,
  0x00, 0x03, 0xc0, 0x00, 0x00, 0x04, 0x40, 0x00, 0x00, 0x0c, 0x20, 0x00, 0x00, 0x0c, 0x20, 0x00,
  0x00, 0x04, 0x40, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const unsigned char PROGMEM ASL_glcd_bmp[] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 
  0x00, 0x00, 0x60, 0x00, 0x00, 0x08, 0x21, 0x00, 0x00, 0x0c, 0x03, 0x00, 0x00, 0x00, 0x62, 0x00, 
  0x00, 0x1f, 0xf8, 0x00, 0x00, 0x3f, 0x0c, 0x00, 0x00, 0x61, 0x84, 0x00, 0x00, 0xc0, 0xc4, 0xe0, 
  0x01, 0xc0, 0xf4, 0x00, 0x03, 0x00, 0x1c, 0x00, 0x06, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x0c, 0x00, 
  0x06, 0x10, 0xcd, 0x00, 0x03, 0x10, 0x99, 0x00, 0x01, 0x84, 0x30, 0x00, 0x00, 0x25, 0x00, 0x00, 
  0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 
  };

char* Message[] = {"This is string 1",
                   "Already initialized",
                   "Cb not assigned",
                   "Invalid GUID",
                   "Unknown server address",
                   "Unknow location ID",
                   "Initialized",
                   "Channel limit exceeded",
                   "Disconnected",
                   "Register in progress",
                   "Iterate fail",
                   "Protocol version error",
                   "Bad credentials",
                   "Temporarily unawaliable",
                   "Location conflict",
                   "Channel conflict",
                   "Registered and ready",
                   "Device is diasbled",
                   "Location is disabled",
                   "Device limit execeeded"
                  };



#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
WiFiClient client;

// Setup Supla connection
const char* ssid     = "122";
const char* password = "k2229";

char str[10];
char StatCommStr[25];
int StatCommInt;
byte Icon;
byte FiveSek;





// BME280 Sensor read implementation
void get_temperature_and_humidity (int channelNumber, double *temp, double *humidity){
  
    *temp = bme.readTemperature();
    Serial.print("Temperature = ");
    Serial.print(bme.readTemperature());
    Serial.println(" *C");
    
    *humidity = bme.readHumidity();
    Serial.print("Humidity = ");
    Serial.print(bme.readHumidity());
    Serial.println(" %");
    if ( isnan(*temp) || isnan(*humidity) ) {
      *temp = -275;
      *humidity = -1;
    }

  
  }
double get_pressure(int channelNumber, double pressure) {
   
 pressure = bme.readPressure();
   return  pressure; 
}

void timer0_ISR (void) {
  FiveSek++;
  if (FiveSek==5) {
    FiveSek=0;
    Icon++;
    if (Icon==5) Icon=1;
  }
  timer0_write(ESP.getCycleCount() + 80000000L); // 80MHz == 1sec 
}


void setup() {
  // Init Serial port
  Serial.begin(115200);

  noInterrupts();
  timer0_isr_init();
  timer0_attachInterrupt(timer0_ISR);
  timer0_write(ESP.getCycleCount() + 80000000L); // 80MHz == 1sec
  interrupts();
 
  if (!bme.begin(0x76)) {
    Serial.println("Could not find a valid BME280 sensor, check wiring!");
    while (1);
    }

  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3C (for the 128x64)
 
  Icon = 0;

  // Clear the buffer.
  display.clearDisplay();

  // text display tests
  display.setTextSize(3);
  display.setTextColor(WHITE);
  display.setRotation(2);
  display.setCursor(30, 25);
  display.print("SUPLA");
  drawbitmap(logo32_glcd_bmp, LOGO32_GLCD_HEIGHT, LOGO32_GLCD_WIDTH);
  display.display();





  // Replace the falowing GUID
char GUID[SUPLA_GUID_SIZE] = {0x93,0x39,0x57,0xF4,0xBC,0x95,0xC2,0x30,0xE0,0x2E,0x47,0x88,0x22,0x6F,0x08,0x12};

  // with GUID that you can retrieve from https://www.supla.org/arduino/get-guid

  // Ethernet MAC address
  uint8_t mac[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

  /*
     Having your device already registered at cloud.supla.org,
     you want to change CHANNEL sequence or remove any of them,
     then you must also remove the device itself from cloud.supla.org.
     Otherwise you will get "Channel conflict!" error.
  */


  // CHANNEL0 - Temp 1
    // SuplaDevice.addBME280();  // to jest kopia SuplaDevice.addDHT22() pod inną nazwą
   
    SuplaDevice.addDHT22(); // ten objekt jest tylko po to aby w aplikacji wyświetlić temp i wilgotność 
    SuplaDevice.addPressureSensor(); // ten obiekt wyświetla nam ciśnienie atm. 
  

  
  SuplaDevice.setStatusFuncImpl(&status_func);
  SuplaDevice.setName("R@F_POG");
  SuplaDevice.begin(GUID,              // Global Unique Identifier
                    mac,               // Ethernet MAC address
                    "svr5.supla.org",  // SUPLA server address
                    0,                 // Location ID
                    "11");               // Location Password

}


// ***********************************************************************************************************
void loop() {
  SuplaDevice.iterate();
  DisplayTemp();

}

// ***********************************************************************************************************

void DisplayTemp() {

  display.clearDisplay();
  display.setTextSize(3);
  display.setTextColor(WHITE);
  display.setRotation(2);
  display.setCursor(45, 25);  
 
  switch (Icon) {
      case 1:
         display.setTextSize(3);
          display.setCursor(45, 25);  
        display.print(bme.readTemperature(), 0);
        display.print((char)247);
        display.println("C");
        drawbitmap(temp_glcd_bmp, LOGO32_GLCD_HEIGHT, LOGO32_GLCD_WIDTH);
        
        break;
      case 2:
       display.setTextSize(3);
        display.setCursor(45, 25);  
        display.print(bme.readHumidity(), 0);
        display.println("%");

        drawbitmap(humidity_glcd_bmp, LOGO32_GLCD_HEIGHT, LOGO32_GLCD_WIDTH);
        break;
      case 3:
         display.setTextSize(2);
          display.setCursor(45, 25);  
        display.print(bme.readPressure() / 100.0F, 0);
        display.println("hPa");
        drawbitmap(pressure_glcd_bmp, LOGO32_GLCD_HEIGHT, LOGO32_GLCD_WIDTH);
        break;
      case 4:
        display.setTextSize(2);
         display.setCursor(35, 25);  
        display.print(bme.readAltitude(SEALEVELPRESSURE_HPA), 0);
        display.println("npm");
        drawbitmap(ASL_glcd_bmp, LOGO32_GLCD_HEIGHT, LOGO32_GLCD_WIDTH);
        break;
        
  };
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0, 55);
  display.print(Message[StatCommInt - 1]);
  display.display();
  display.display();

}; //DisplayTemp

void drawbitmap(const uint8_t *bitmap, uint8_t w, uint8_t h) {
  uint8_t icons[NUMFLAKES][3];

  display.drawBitmap(0, 0, bitmap, w, h, WHITE);
} //drawbitmap


// Supla.org ethernet layer
int supla_arduino_tcp_read(void *buf, int count) {
  _supla_int_t size = client.available();

  if ( size > 0 ) {
    if ( size > count ) size = count;
    return client.read((uint8_t *)buf, size);
  };

  return -1;
};

int supla_arduino_tcp_write(void *buf, int count) {
  return client.write((const uint8_t *)buf, count);
};

bool supla_arduino_svr_connect(const char *server, int port) {
  return client.connect(server, 2015);
}

bool supla_arduino_svr_connected(void) {
  return client.connected();
}

void supla_arduino_svr_disconnect(void) {
  client.stop();
}

void supla_arduino_eth_setup(uint8_t mac[6], IPAddress *ip) {

  // Serial.println("WiFi init");
  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    //    Serial.print(".");
  }

  //Serial.print("\nlocalIP: ");
  //Serial.println(WiFi.localIP());
  //Serial.print("subnetMask: ");
  //Serial.println(WiFi.subnetMask());
  //Serial.print("gatewayIP: ");
  //Serial.println(WiFi.gatewayIP());
}

SuplaDeviceCallbacks supla_arduino_get_callbacks(void) {
  SuplaDeviceCallbacks cb;

  cb.tcp_read = &supla_arduino_tcp_read;
  cb.tcp_write = &supla_arduino_tcp_write;
  cb.eth_setup = &supla_arduino_eth_setup;
  cb.svr_connected = &supla_arduino_svr_connected;
  cb.svr_connect = &supla_arduino_svr_connect;
  cb.svr_disconnect = &supla_arduino_svr_disconnect;
  cb.get_temperature_and_humidity = get_temperature_and_humidity;
  cb.get_temperature = NULL;
  cb.get_rgbw_value = NULL;
  cb.set_rgbw_value = NULL;
  cb.get_pressure= get_pressure;

  return cb;
}



void status_func(int status, const char *msg) {
  Serial.print("Status : ");
  Serial.print(status);
  StatCommInt = status;
  Serial.print(" - ");
  Serial.println(Message[StatCommInt - 1]);
  display.fillRect(0, 55, 128, 65, BLACK);

  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setRotation(2);
  display.setCursor(0, 55);
  display.print(Message[StatCommInt - 1]);
  display.display();

}
jak coś nie działa to włącz zasilanie.....
Asica10
Posts: 63
Joined: Thu Feb 28, 2019 8:12 pm

Post

Kurde.... dalej to samo... Mógłbyś wrzucić swoje biblioteki? może z moimi jest coś nie tak. Bo innego pomysłu już nie mam.

BTW// Testowałeś ten soft an Wemosie D1 mini?

Return to “Pomoc”