Bład przy kompilacji - Wersja do druku +- Arduino Polska Forum (https://forum.arduinopolska.pl) +-- Dział: Korzystanie z Arduino (https://forum.arduinopolska.pl/dzial-korzystanie-z-arduino) +--- Dział: Piaskownica (https://forum.arduinopolska.pl/dzial-piaskownica) +--- Wątek: Bład przy kompilacji (/watek-b%C5%82ad-przy-kompilacji--3485) |
Bład przy kompilacji - romek123 - 30-03-2020 Witam ,jestem nowy i mam problem z kompilecja wywala mi bład , a nie bardzowiem o co chodzi Coś takiego mi wypisuje: -------------------------------------------------------------------------------------------------------------------------------------------- code-zew:17:1: error: 'dht' does not name a type dht DHT; // Creates a DHT object ^~~ C:\Arduino\Projekty\stacja pogodowa-HISZPANSKA\code-zew\code-zew.ino: In function 'void loop()': code-zew:29:21: error: expected primary-expression before '.' token int readData = DHT.read22(dataPin); // Reads the data from the sensor ^ code-zew:30:14: error: expected primary-expression before '.' token int t = DHT.temperature; // Gets the values of the temperature ^ code-zew:31:14: error: expected primary-expression before '.' token int h = DHT.humidity; // Gets the values of the humidity ^ exit status 1 'dht' does not name a type ------------------------------------------------------------------------------------------------------------------------------------------------ A to cały kod: ---------------------------------------------------------------------------------------------------------------------------------------------- /* Arduino Wireless Communication Tutorial Outdoor unit - Transmitter by Dejan Nedelkovski, www.HowToMechatronics.com Libraries: NRF24L01 - TMRh20/RF24, https://github.com/tmrh20/RF24/ DHT22 - DHTlib, https://github.com/RobTillaart/Arduino/tree/master/libraries/DHTlib LowPower - https://github.com/rocketscream/Low-Power */ #include <SPI.h> #include <nRF24L01.h> #include <RF24.h> #include <dht.h> #include <LowPower.h> #define dataPin 8 // DHT22 data pin dht DHT; // Creates a DHT object RF24 radio(10, 9); // CE, CSN const byte address[6] = "00001"; char thChar[32] = ""; String thString = ""; void setup() { radio.begin(); radio.openWritingPipe(address); radio.setPALevel(RF24_PA_MIN); radio.stopListening(); } void loop() { int readData = DHT.read22(dataPin); // Reads the data from the sensor int t = DHT.temperature; // Gets the values of the temperature int h = DHT.humidity; // Gets the values of the humidity thString = String(t) + String(h); thString.toCharArray(thChar, 12); // Sent the data wirelessly to the indoor unit for (int i = 0; i <= 3; i++) { // Send the data 3 times radio.write(&thChar, sizeof(thChar)); delay(50); } // Sleep for 2 minutes, 15*8 = 120s for (int sleepCounter = 15; sleepCounter > 0; sleepCounter--) { LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); } } ------------------------------------------------------------------------------------------------------------------------------------------- Już 2 dni siedzę i nie wiem jak to ugryść Może ktoś pomoże RE: Bład przy kompilacji - kaczakat - 30-03-2020 Musisz mieć zainstalowane biblioteki, dokładnie takie same jak autora, jak projekt stary to czasami jest wymagana stara wersja Arduino (były istotne zmiany w okolicy 1.5), jeśli masz dwie libki różne o tych samych nazwach, a wymagające innych funkcji to też program nie zrozumie o co Ci chodzi. RE: Bład przy kompilacji - romek123 - 30-03-2020 ok dziękuję bardzo bede próbował RE: Bład przy kompilacji - romek123 - 30-03-2020 Znalazłem stare biblioteki i wszystko poszło ,jest ok Wielkie dzięki |