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/t...ies/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
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/t...ies/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