Skocz do zawartości

Maciokeks

Użytkownicy
  • Zawartość

    2
  • Rejestracja

  • Ostatnio

Reputacja

0 Neutralna

O Maciokeks

  • Ranga
    1/10
  1. Witam mam problem z pobieraniem temperatury z Openweathermap, gdyż kiedy minie 10s to na ekranie w polu P(ciśnienie) pokazują się zbyt wysokie liczby tak samo na innych polach gdzie są zmienne wstawione do wyświetlania. Ogólnie wszystko się ładnie kompiluje ale występują takie problemy. Wszystko prawidłowo działa jak jest czysty kod do pobierania informacji z OpenWeathermap. Do wemosa D1 mini pro jest podpięty DS18B20, DS1307, 1.8 tft display i pasek 8 diod WS (na razie nie miałem czasu je odpalać) #include <OneWire.h> #include <DallasTemperature.h> OneWire oneWire(D4); //Podłączenie do A5 DallasTemperature sensors(&oneWire); //Przekazania informacji do biblioteki #include <Adafruit_GFX.h> // Core graphics library #include <Adafruit_ST7735.h> // Hardware-specific library #include <SPI.h> #define TFT_CS D8 #define TFT_RST -1 #define TFT_DC D3 //Option 1: faster Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST); // Option 2: use any pins but a little slower! #define TFT_SCLK D5 // set these to be whatever pins you like! #define TFT_MOSI D7 // set these to be whatever pins you like! //Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST); #include <Wire.h> #include "RTClib.h" RTC_DS1307 rtc; char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; #include <Arduino.h> #include <ESP8266WiFi.h> #include <JsonListener.h> #include <time.h> #include "OpenWeatherMapCurrent.h" OpenWeatherMapCurrent client; String OPEN_WEATHER_MAP_APP_ID = "xx"; String OPEN_WEATHER_MAP_LOCATION_ID = "769250"; String OPEN_WEATHER_MAP_LANGUAGE = "pl"; boolean IS_METRIC = true;//true-*C flase-farenheit const char* ESP_HOST_NAME = "esp-weather_station" + ESP.getFlashChipId(); const char* WIFI_SSID = "xx"; const char* WIFI_PASSWORD = "xx"; WiFiClient wifiClient; void setup() { Serial.begin(115200); delay(1000); WiFi.begin(WIFI_SSID, WIFI_PASSWORD); if (! rtc.begin()) { Serial.println("Couldn't find RTC"); while (1); } rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); tft.initR(INITR_BLACKTAB); tft.fillScreen(ST7735_BLACK); tft.setTextWrap(false); sensors.begin(); wifiinit(); delay(5000); tft.fillScreen(ST7735_BLACK); stext(); } void loop() { //tft.fillScreen(ST7735_BLACK); weather(); rtcget(); tempget(); if(WiFi.status() == WL_CONNECTED){ tft.setCursor(26, 143); tft.setTextColor(ST7735_GREEN, ST7735_BLACK); tft.setTextSize(1); tft.println("ON "); }else{ Serial.print("ERR.. check your internet connection"); tft.setCursor(26, 143); tft.setTextColor(ST7735_RED, ST7735_BLACK); tft.setTextSize(1); tft.println("OFF"); } } /////////////////////////////////////////////////////////////////////////////////voidy//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void wifiinit() { WiFi.begin(WIFI_SSID, WIFI_PASSWORD); Serial.print("Connecting to "); Serial.println(WIFI_SSID); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected!"); Serial.println(WiFi.localIP()); Serial.println(); tft.drawRect(0, 0, 127, 160, ST7735_GREEN);// Draw rectangle (x,y,width,height,color) delay(500); tft.setCursor(20, 10); // Set position (x,y) tft.setTextColor(ST7735_GREEN); // Set color of text. First is the color of text and after is color of background tft.setTextSize(2); // Set text size. Goes from 0 (the smallest) to 20 (very big) tft.println("Welcome"); tft.setCursor(20, 30); tft.setTextSize(1); tft.println("connected to:"); tft.setCursor(20,40); tft.println(WIFI_SSID); tft.setCursor(20, 55); tft.print("IP address:"); tft.setCursor(20,65); tft.print(WiFi.localIP()); } void rtcget(){ DateTime now = rtc.now(); delay(1000); tft.setCursor(38, 20); tft.setTextColor(ST7735_WHITE, ST7735_BLACK); tft.setTextSize(2); tft.println(now.hour(), DEC); tft.setCursor(59, 20); tft.setTextColor(ST7735_WHITE); tft.setTextSize(2); tft.print(":"); tft.setCursor(68, 20); tft.setTextColor(ST7735_WHITE, ST7735_BLACK); tft.setTextSize(2); tft.println(now.minute(), DEC); //tft.setCursor(95, 26); //tft.setTextColor(ST7735_WHITE, ST7735_BLACK); //tft.setTextSize(1); //tft.print(now.second(), DEC); tft.setCursor(38, 40); tft.setTextColor(ST7735_WHITE, ST7735_BLACK); tft.setTextSize(1); tft.println(now.day()); tft.setCursor(50, 40); tft.setTextColor(ST7735_WHITE); tft.setTextSize(1); tft.println("."); tft.setCursor(56, 40); tft.setTextColor(ST7735_WHITE, ST7735_BLACK); tft.setTextSize(1); tft.println(now.month()); tft.setCursor(60, 40); tft.setTextColor(ST7735_WHITE); tft.setTextSize(1); tft.println("."); tft.setCursor(66, 40); tft.setTextColor(ST7735_WHITE, ST7735_BLACK); tft.setTextSize(1); tft.println(now.year()); tft.setCursor(45, 49); tft.setTextColor(ST7735_WHITE, ST7735_BLACK); tft.setTextSize(1); tft.println(daysOfTheWeek[now.dayOfTheWeek()]); /* Serial.println("Current Date & Time: "); Serial.print(now.year(), DEC); Serial.print('/'); Serial.print(now.month(), DEC); Serial.print('/'); Serial.print(now.day(), DEC); Serial.print(" ("); Serial.print(daysOfTheWeek[now.dayOfTheWeek()]); Serial.print(") "); Serial.print(now.hour(), DEC); Serial.print(':'); Serial.print(now.minute(), DEC); Serial.print(':'); Serial.print(now.second(), DEC); Serial.println(); */ } void stext(){ tft.drawRect(0, 0, 128, 160, ST7735_GREEN); //Draw rectangle (x,y,width,height,color) tft.drawLine(0, 135, 159, 135, ST7735_GREEN); // Draw line (x0,y0,x1,y1,color) tft.drawLine(44, 135, 44, 160, ST7735_GREEN); tft.drawLine(0, 60, 128, 60, ST7735_GREEN); tft.drawLine(0, 95, 128, 95, ST7735_GREEN); tft.setCursor(47, 140); tft.setTextColor(ST7735_WHITE); tft.setTextSize(2); tft.print("T"); tft.setCursor(56, 5); tft.setTextColor(ST7735_WHITE); tft.setTextSize(1); tft.print("RTC"); tft.setCursor(4, 143); tft.setTextColor(ST7735_WHITE); tft.setTextSize(1); tft.print("0))"); tft.setCursor(4, 74); tft.setTextColor(ST7735_GREEN); tft.setTextSize(1); tft.print("T:"); tft.setCursor(4,84); tft.setTextColor(ST7735_GREEN); tft.setTextSize(1); tft.print("H:"); tft.setCursor(50, 74); tft.setTextColor(ST7735_GREEN); tft.setTextSize(1); tft.print("C"); tft.setCursor(35,84); tft.setTextColor(ST7735_GREEN); tft.setTextSize(1); tft.print("%"); tft.setCursor(65,74); tft.setTextColor(ST7735_GREEN); tft.setTextSize(1); tft.print("P:"); tft.setCursor(65,84); tft.setTextColor(ST7735_GREEN); tft.setTextSize(1); tft.print("S:"); tft.setCursor(110,74); tft.setTextColor(ST7735_GREEN); tft.setTextSize(1); tft.println("hPa"); tft.setCursor(105,84); tft.setTextColor(ST7735_GREEN); tft.setTextSize(1); tft.print("km/s"); } void tempget(){ sensors.requestTemperatures(); tft.setTextSize(2); tft.setCursor(66, 140); tft.setTextColor(ST7735_WHITE, ST7735_BLACK); tft.print(sensors.getTempCByIndex(0)); } void weather(){ OpenWeatherMapCurrentData data; client.setLanguage(OPEN_WEATHER_MAP_LANGUAGE); client.setMetric(IS_METRIC) client.updateCurrentById(&data, OPEN_WEATHER_MAP_APP_ID, OPEN_WEATHER_MAP_LOCATION_ID); delay(1000); tft.setCursor(16, 84); tft.setTextColor(ST7735_GREEN, ST7735_BLACK); tft.setTextSize(1); tft.print(data.humidity); tft.setCursor(16, 74); tft.setTextColor(ST7735_GREEN, ST7735_BLACK); tft.setTextSize(1); tft.print(data.temp); tft.setCursor(80,84); tft.setTextColor(ST7735_GREEN,ST7735_BLACK); tft.setTextSize(1); tft.print(data.windSpeed); tft.setCursor(80,74); tft.setTextColor(ST7735_GREEN,ST7735_BLACK); tft.setTextSize(1); tft.println(data.pressure); delay(10000); } .Będę bardzo wdzięczny za pomoc . Gdy już będzie wszystko działało opublikuję projekt
  2. Dzień dobry mam problem z klonem arduboyem którego sam zbudowałem. Problem występuje podczas kompilacji programu i wyskakuje taki błąd. Gierkę pobierałem z tej strony https://github.com/TEAMarg/ID-46-Arduventure/releases/tag/v1.0 i przeniosłem folder ARDU_AB na pulpit z tymi plikami i podczas wgrywania wywala mi taki błąd. Mikro-kontroler to arduino nano wraz z oled 128x64. Z góry będę wdzięczny In file included from c:\program files\windowsapps\arduinollc.arduinoide_1.8.21.0_x86__mdqgnx93n4wtt\hardware\tools\avr\avr\include\avr\io.h:99:0, from c:\program files\windowsapps\arduinollc.arduinoide_1.8.21.0_x86__mdqgnx93n4wtt\hardware\tools\avr\avr\include\avr\pgmspace.h:90, from C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:28, from C:\Users\macio\Documents\Arduino\libraries\ATMlib-master\src\ATMlib.h:5, from C:\Users\macio\Documents\Arduino\libraries\ATMlib-master\src\ATMlib.cpp:1: C:\Users\macio\Documents\Arduino\libraries\ATMlib-master\src\ATMlib.cpp: In function 'void TIMER4_OVF_vect()': C:\Users\macio\Documents\Arduino\libraries\ATMlib-master\src\ATMlib.cpp:4:24: error: 'OCR4A' was not declared in this scope ATMLIB_CONSTRUCT_ISR(OCR4A) ^ C:\Users\macio\Documents\Arduino\libraries\ATMlib-master\src\ATMlib.cpp:4:3: note: in expansion of macro 'ATMLIB_CONSTRUCT_ISR' ATMLIB_CONSTRUCT_ISR(OCR4A) ^ C:\Users\macio\Documents\Arduino\libraries\ATMlib-master\src\ATMlib.cpp: In member function 'void ATMsynth::play(const byte*)': C:\Users\macio\Documents\Arduino\libraries\ATMlib-master\src\ATMlib.cpp:112:3: error: 'TIMSK4' was not declared in this scope TIMSK4 = 0b00000000;// ensure interrupt is disabled ^ C:\Users\macio\Documents\Arduino\libraries\ATMlib-master\src\ATMlib.cpp:127:3: error: 'TCCR4A' was not declared in this scope TCCR4A = 0b01000010; // Fast-PWM 8-bit ^ C:\Users\macio\Documents\Arduino\libraries\ATMlib-master\src\ATMlib.cpp:128:3: error: 'TCCR4B' was not declared in this scope TCCR4B = 0b00000001; // 62500Hz ^ C:\Users\macio\Documents\Arduino\libraries\ATMlib-master\src\ATMlib.cpp:129:3: error: 'OCR4C' was not declared in this scope OCR4C = 0xFF; // Resolution to 8-bit (TOP=0xFF) ^ C:\Users\macio\Documents\Arduino\libraries\ATMlib-master\src\ATMlib.cpp:130:3: error: 'OCR4A' was not declared in this scope OCR4A = 0x80; ^ C:\Users\macio\Documents\Arduino\libraries\ATMlib-master\src\ATMlib.cpp: In member function 'void ATMsynth::stop()': C:\Users\macio\Documents\Arduino\libraries\ATMlib-master\src\ATMlib.cpp:152:3: error: 'TIMSK4' was not declared in this scope TIMSK4 = 0; // Disable interrupt ^ C:\Users\macio\Documents\Arduino\libraries\ATMlib-master\src\ATMlib.cpp: In member function 'void ATMsynth::playPause()': C:\Users\macio\Documents\Arduino\libraries\ATMlib-master\src\ATMlib.cpp:159:3: error: 'TIMSK4' was not declared in this scope TIMSK4 = TIMSK4 ^ 0b00000100; // toggle disable/enable interrupt ^ C:\Users\macio\Documents\Arduino\libraries\ATMlib-master\src\ATMlib.cpp: In function 'void ATM_playroutine()': C:\Users\macio\Documents\Arduino\libraries\ATMlib-master\src\ATMlib.cpp:424:9: error: 'TIMSK4' was not declared in this scope TIMSK4 = 0; // Disable interrupt ^ exit status 1 Błąd kompilacji dla płytki Arduino Nano.
×
×
  • Utwórz nowe...