Скетч показал error, помогите, где ошибка?

Dona_balkanska
Dona_balkanska аватар
Offline
Зарегистрирован: 16.10.2016
#include <SoftwareSerial.h>
#include <String.h>
#include <EEPROM.h>
#include <Wire.h>
#include <SPI.h>
#include <Ethernet.h>
#include <dht.h>

// pins definition
SoftwareSerial sim800l(7, 6); // actual RX, TX pins of SIM800l board
const int TestButton = 10; // internal pull-up activated, button is wired to GND, LOW when pressed
const int LEDPowerFailure = 9;
const int LEDTemperatureFailure = 4;
const int LEDLANFailure = 11;
const int LEDDiagnostics = 13; // internal LED for diagnostics
const int PowerSenseInput= A1; // from DC adapter via a voltage divider 
const int DHT11Pin = 12; 	   // DHT11 onewire pin

// failure definitions constants - bitwise
const int StateOk = 0;
const int StatePowerDownFailure = 1;
const int StateLANFailure = 2;
const int StateTemperatureFailure = 4;
const int StateTest = 8;

float TempSensorValue; // current temperature from sensor DHT11
float PowerSenseInputValue; // voltage after divider
int   PingFailure = 0; // flag 
int   PingCountOk; // counter
int   TestButtonState; // pressed LOW
int   State = StateOk; // status of the net/temp/power/test

// User configurable variables (via source recompile and upload to Arduino board again)
// pinging
byte useDhcp = true;
byte useDns = true;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
// these valus must be changed
IPAddress deviceIp(192, 168, 1, 100); // Only if useDhcp is false !!!
IPAddress gatewayIp(192, 168, 1, 1); // Only if useDhcp is false  !!!
IPAddress dnsIp(192, 168, 1, 1); // Only if useDhcp is false   !!!
IPAddress subnet(255, 255, 255, 0); // Only if useDhcp is false !!!
IPAddress serverIp(173, 230, 152, 173); // Only if useDns is false !!!
char serverName[] = "server1.tu-plovdiv.bg"; // Only if useDns is true !!!
// thresholds
const int TemperatureAlarmValue = 36; // over 36C - alarm
const int PingCountAlarmValue = 3; // over 3 lost packets - alarm
const float DCPowerAlarmValue = 0.5; // under 0.5 volts after voltage diveider - alarm
const float DCPowerVoltage = 9.0; // voltage of the power adaptor

EthernetClient Client; // Declare client object
dht DHT; // DHT object

void setup() // initialise ports/values
{
  pinMode(TestButton, INPUT_PULLUP); // LOW when pressed
  // LEDs - light on HIGH
  pinMode(LEDPowerFailure, OUTPUT);
  pinMode(LEDTemperatureFailure, OUTPUT);
  pinMode(LEDLANFailure, OUTPUT);
  pinMode(LEDDiagnostics, OUTPUT);
  // initialise Serial and SIM800l
  sim800l.begin(9600); // initialize SIM800l module at 9600 bps
  Serial.begin(9600);  // debug messages to serial monitor of Arduino IDE
  delay(500); // wait for proper initialization of the SIM800l 500mS
}
 
void loop()
{
  State = StateOk;

  // check  
  TestButtonState = digitalRead(buttonPin); // if LOW - do diagnostic (Power failure simulation)
  if (TestButtonState == LOW) { // test diagnostic SMS and PowerLow LED simulation
	Serial.println("Diagnostics button pressed.");
	State = State | StateTest;
  }
  
  // check temperature
  int chk = DHT.read11(DHT11Pin);
  if (chk == DHTLIB_OK) {
	TempSensorValue = DHT.temperature;
	if (TempSensorValue > TemperatureAlarmValue) {
		State = State | StateTemperatureFailure;
		Serial.print("Temperature overflow ");
		Serial.println(TempSensorValue, 1);
	}		
  }
    
  // check power down state, read twice after 500ms to avoid brownouts
  PowerSenseInputValue = analogRead(PowerSenseInput) * (DCPowerVoltage / 2.0) / 1024;
  if (PowerSenseInputValue < DCPowerAlarmValue) {
		delay(500); // wait for brownout 500mS
		PowerSenseInputValue = analogRead(PowerSenseInput) * (DCPowerVoltage / 2.0) / 1024;
		if (PowerSenseInputValue < DCPowerAlarmValue) {
			State = State | StatePowerDownFailure;
			Serial.println("Power down.");
		}
	}		

  // check ping state of the server
  // ..
  if (PingFailure) {
	State = State | StatePowerDownFailure;
	Serial.println("Ping failed - server is down.");
  }
  
  // process state
 
  if (sim800l.available()){ // is SIM800l receive SMS or status - dump it back
    Serial.write(sim800l.read()); 
  }
}
 
void SendTextMessage()
{
  Serial.println("Sending Text Message...");
  //
  sim800l.print("AT+CMGF=1\r"); // Set the shield to SMS mode
  delay(100);
  sim800l.print("AT+CMGS=\"+3591234567\"\r");  // put actual number here
  delay(200);
  //
  sim800l.print("Failure is: ");
  // ... by State...
  sim800l.print("\r"); //the content of the message
  delay(500);
  sim800l.print((char)26); //the ASCII code of the ctrl+z is 26 (required ^Z at end of SMS)
  delay(100);
  sim800l.println();
  Serial.println("Text Message Sent.");
  delay(500);
}

 

Dona_balkanska
Dona_balkanska аватар
Offline
Зарегистрирован: 16.10.2016

Ардуино Уно, SIM800L, DHT11, Ethernet shield HR911105A- для отслеживания температуры и вне установленного предела для отправки SMS.

ЕвгенийП
ЕвгенийП аватар
Offline
Зарегистрирован: 25.05.2015

Чего показал? Кому показал? Секреты кругом? Мож поделитесь?

Dona_balkanska
Dona_balkanska аватар
Offline
Зарегистрирован: 16.10.2016

Araris
Offline
Зарегистрирован: 09.11.2012

Видите ли Вы на картинке серую кнопку с надписью "Copy error messages" ? Просто воспользуйтесь ей.

Dona_balkanska
Dona_balkanska аватар
Offline
Зарегистрирован: 16.10.2016

Arduino: 1.6.11 (Windows 10), Board: "Arduino/Genuino Uno"

 

C:\Users\admin\Desktop\ServerGuard_Dona_with_SIM800l\ServerGuard_Dona_with_SIM800l.ino:7:17: fatal error: dht.h: No such file or directory

 

 #include <dht.h>

 

ЕвгенийП
ЕвгенийП аватар
Offline
Зарегистрирован: 25.05.2015

Dona_balkanska пишет:

 No such file or directory

Какое из этих пяти слов Вам непонятно?

ну, не нашёл он файла dht.h. Либо его нет, либо лежит не там, где его ожидают увидеть.

Скорее всего нет, т.к. тот что есть он у Вас наверняка DHT.h

Dona_balkanska
Dona_balkanska аватар
Offline
Зарегистрирован: 16.10.2016
Arduino: 1.6.11 (Windows 10), Board: "Arduino/Genuino Uno"
 
C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\admin\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10611 -build-path C:\Users\admin\AppData\Local\Temp\build6c05afd1daa069923af9a8b35fa559f3.tmp -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\admin\Desktop\ServerGuard_Dona_with_SIM800l\ServerGuard_Dona_with_SIM800l.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\admin\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10611 -build-path C:\Users\admin\AppData\Local\Temp\build6c05afd1daa069923af9a8b35fa559f3.tmp -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\admin\Desktop\ServerGuard_Dona_with_SIM800l\ServerGuard_Dona_with_SIM800l.ino
Using board 'uno' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Using core 'arduino' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Detecting libraries used...
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Users\admin\AppData\Local\Temp\build6c05afd1daa069923af9a8b35fa559f3.tmp\sketch\ServerGuard_Dona_with_SIM800l.ino.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial\src" "C:\Users\admin\AppData\Local\Temp\build6c05afd1daa069923af9a8b35fa559f3.tmp\sketch\ServerGuard_Dona_with_SIM800l.ino.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial\src" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM\src" "C:\Users\admin\AppData\Local\Temp\build6c05afd1daa069923af9a8b35fa559f3.tmp\sketch\ServerGuard_Dona_with_SIM800l.ino.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial\src" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM\src" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src" "C:\Users\admin\AppData\Local\Temp\build6c05afd1daa069923af9a8b35fa559f3.tmp\sketch\ServerGuard_Dona_with_SIM800l.ino.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial\src" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM\src" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src" "C:\Users\admin\AppData\Local\Temp\build6c05afd1daa069923af9a8b35fa559f3.tmp\sketch\ServerGuard_Dona_with_SIM800l.ino.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial\src" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM\src" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src" "-IC:\Users\admin\Documents\Arduino\libraries\Ethernet\src" "C:\Users\admin\AppData\Local\Temp\build6c05afd1daa069923af9a8b35fa559f3.tmp\sketch\ServerGuard_Dona_with_SIM800l.ino.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src" "-IC:\Users\admin\Documents\Arduino\libraries\Ethernet\src" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial\src" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM\src" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src" "C:\Users\admin\AppData\Local\Temp\build6c05afd1daa069923af9a8b35fa559f3.tmp\sketch\ServerGuard_Dona_with_SIM800l.ino.cpp" -o "C:\Users\admin\AppData\Local\Temp\build6c05afd1daa069923af9a8b35fa559f3.tmp\preproc\ctags_target_for_gcc_minus_e.cpp"
C:\Users\admin\Desktop\ServerGuard_Dona_with_SIM800l\ServerGuard_Dona_with_SIM800l.ino:7:17: fatal error: DHT.h: No such file or directory
 
 #include <DHT.h>
 
                 ^
 
compilation terminated.
 
Multiple libraries were found for "Ethernet.h"
 Used: C:\Users\admin\Documents\Arduino\libraries\Ethernet
 Not used: C:\Program Files (x86)\Arduino\libraries\Ethernet
Using library SoftwareSerial at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial 
Using library EEPROM at version 2.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM 
Using library Wire at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire 
Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI 
Using library Ethernet at version 1.1.1 in folder: C:\Users\admin\Documents\Arduino\libraries\Ethernet 
exit status 1
Error compiling for board Arduino/Genuino Uno.
Dona_balkanska
Dona_balkanska аватар
Offline
Зарегистрирован: 16.10.2016

Все ошибок :(

ЕвгенийП
ЕвгенийП аватар
Offline
Зарегистрирован: 25.05.2015

Ну, значит и такого нет. У Вас он вообще есть? либо его нет. либо лежит в неправильном месте. Поищите.

Клапауций 232
Offline
Зарегистрирован: 05.04.2016

ЕвгенийП пишет:

Ну, значит и такого нет. У Вас он вообще есть? либо его нет. либо лежит в неправильном месте. Поищите.

я запретил поиск.

Dona_balkanska
Dona_balkanska аватар
Offline
Зарегистрирован: 16.10.2016

Спасибо.

Valera19701
Valera19701 аватар
Offline
Зарегистрирован: 18.10.2015

у вас нет библиотеки DHT, вот и ругается

Dona_balkanska
Dona_balkanska аватар
Offline
Зарегистрирован: 16.10.2016

Я прикрепила библиотеку