I cant upload please help !

hello ,

I intend to make chicken incubator using arduino uno but every time i copy codes to the arduino IDE i face below error while uploading . ( codes are not written by me )

here is the error :

Arduino: 1.8.3 (Windows 8.1), Board: "Arduino/Genuino Uno"

C:\Users\Gharaei.m\Documents\Arduino__.ino:2:17: fatal error: DHT.h: No such file or directory

#include "DHT.h"

^

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

and here is the codes :

#include <LiquidCrystal.h>
#include "DHT.h"
#define DHTPIN 2 // Define the temp sensor data pin
#define DHTTYPE DHT22 // define the temp/hum sensor type
#define RELAY 0 // define the relay control pin
DHT dht(DHTPIN, DHTTYPE); //initialize the temp sensor
// LCD Connections:
// rs (LCD pin 4) to Arduino pin 12
// rw (LCD pin 5) to Arduino pin 11
// enable (LCD pin 6) to Arduino pin 10
// LCD pin 15 to Arduino pin 13
// LCD pins d4, d5, d6, d7 to Arduino pins 5, 4, 3, 1
LiquidCrystal lcd(8,9,4,5,6,7); //set up what port the LCD will use
int backLight = 13; // pin 13 will control the backlight
void setup()
{
dht.begin(); //start the temp sensor
pinMode(RELAY, OUTPUT);
pinMode(backLight, OUTPUT);
digitalWrite(backLight, HIGH); // turn backlight on. Replace 'HIGH' with 'LOW' to turn it off.
lcd.begin(20,4); // columns, rows. use 16,2 for a 16x2 LCD, etc.
lcd.clear(); // start with a blank screen
lcd.setCursor(0,0); // set cursor to column 0, row 0 (the first row)
lcd.print("Incubator); // opening line
lcd.setCursor(0,1); // set cursor to column 0, row 1
lcd.print("Hatch!");
delay(2000);
// Uncomment if you want more text on the 4 line LCD (not used in 2 line LCDs)
// lcd.setCursor(0,2); // set cursor to column 0, row 2
// lcd.print("Row //Text for line 3
//lcd.setCursor(0,3); // set cursor to column 0, row 3
//lcd.print("Row // Text for line 4
}
//loop to read the sensor and display
void loop(){
float h = dht.readHumidity(); // Read the humidity
float t = dht.readTemperature(); // Read temperature in celsius
float f = dht.readTemperature(true); // get the temperature in Fahreheit
// uncomment to compute heat index in Fahrenheit (the default)
//float hif = dht.computeHeatIndex(f, h);
// Compute heat index in Celsius (isFahreheit = false)
//float hic = dht.computeHeatIndex(t, h, false);
int is,im,ih,id,ida; // variables for time
float time,s1,m1,h1,d1; // Set up variables to calculate time
time=millis(); // Get time in milliseconds since tunit turn on
s1=time/1000; // Convert time to seconds, minutes, hours, days
m1=s1/60;
h1=m1/60;
d1=h1/24;
id=int(d1); // Strip out remainder to leave Days:Hours:Minutes:Seconds
ih=int((d1-int(d1))*24);
im=int((h1-int(h1))*60);
is=int((m1-int(m1))*60);
// Calculate approximate days till hatch (assume 21 days to hatch)
ida=21-id;
if (isnan(h) || isnan(t) || isnan(f)){
// if sensor can't be read
lcd.clear();
lcd.setCursor(0,0);
lcd.print("failedead");
delay(50000);
return;
}
else {
//sensor was read succesfully so print values to LCD
lcd.clear(); // Clear the LCD
//Print temperature and humidity in first two lines
lcd.setCursor(0,0);
lcd.print("Temperature")
lcd.print(f,1);
lcd.print(" F");
lcd.setCursor(0,1);
lcd.print("Humidity")
lcd.print(h,0);
lcd.print(" %");
lcd.setCursor(0,2);
lcd.print("Time
// Print time in format Time: xxd:xxh:xxm:xxs
lcd.print(id);
lcd.print("d
lcd.print(ih);
lcd.print("h
lcd.print(im);
lcd.print("m
lcd.print(is);
lcd.print("s
lcd.setCursor(0,3);
// Print days left till hatch
lcd.print("Days:");
lcd.print(21-id);
//Temperature controller
if(f<91){ // Set the temperature for the relay to come on (somewhere around 90-101F to get eggs to hatch)
digitalWrite(RELAY,LOW); // Turns ON Relay
}
else{
digitalWrite(RELAY,HIGH); // Turns Relay Off
}
// Puase for 5 seconds
delay(5000);
}
}

looking at the error message it appears that you have not installed the DHT library

for help see

And use code tags when posting code

Problem solved , Thank you very mush .

hi , can anyone here help me with below error please , how can i solve it ?

Arduino: 1.8.3 (Windows 8.1), Board: "Arduino/Genuino Uno"

In file included from C:\Users\Gharaei.m\Desktop\egg-incubator-master\incubator\incubator.ino:2:0:

C:\Users\Gharaei.m\Documents\Arduino\libraries\SoftwareServo/SoftwareServo.h:2:24: warning: ISO C99 requires whitespace after the macro name

#define SoftwareServo_h#include <Arduino.h>

^

In file included from C:\Users\Gharaei.m\Documents\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:1:0:

C:\Users\Gharaei.m\Documents\Arduino\libraries\SoftwareServo/SoftwareServo.h:2:24: warning: ISO C99 requires whitespace after the macro name

#define SoftwareServo_h#include <Arduino.h>

^

C:\Users\Gharaei.m\Documents\Arduino\libraries\SoftwareServo\SoftwareServo.cpp: In member function 'uint8_t SoftwareServo::attach(int)':

C:\Users\Gharaei.m\Documents\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:27:23: error: 'digitalWrite' was not declared in this scope

digitalWrite(pin,0);

^

C:\Users\Gharaei.m\Documents\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:28:17: error: 'OUTPUT' was not declared in this scope

pinMode(pin,OUTPUT);

^

C:\Users\Gharaei.m\Documents\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:28:23: error: 'pinMode' was not declared in this scope

pinMode(pin,OUTPUT);

^

C:\Users\Gharaei.m\Documents\Arduino\libraries\SoftwareServo\SoftwareServo.cpp: In member function 'void SoftwareServo::write(int)':

C:\Users\Gharaei.m\Documents\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:51:51: error: 'clockCyclesPerMicrosecond' was not declared in this scope

pulse0 = (min1616LclockCyclesPerMicrosecond() + (max16-min16)(16LclockCyclesPerMicrosecond())*angle/180L)/64L;

^

C:\Users\Gharaei.m\Documents\Arduino\libraries\SoftwareServo\SoftwareServo.cpp: In static member function 'static void SoftwareServo::refresh()':

C:\Users\Gharaei.m\Documents\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:73:30: error: 'millis' was not declared in this scope

unsigned long m = millis();

^

C:\Users\Gharaei.m\Documents\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:106:60: error: 'digitalWrite' was not declared in this scope

for ( i = 0; i < count; i++) digitalWrite( s*->pin, 1);*

  • ^*
    C:\Users\Gharaei.m\Documents\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:108:21: error: 'TCNT0' was not declared in this scope
  • uint8_t start = TCNT0;*
  • ^*
    C:\Users\Gharaei.m\Documents\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:123:28: error: 'digitalWrite' was not declared in this scope
    _ digitalWrite( s*->pin,0);_
    _
    ^_
    exit status 1
    Error compiling for board Arduino/Genuino Uno.
    This report would have more information with
    _
    "Show verbose output during compilation"*_
    option enabled in File -> Preferences.

No it's not because of that the codes are written right you can check them .

incubator.ino (12.3 KB)

The compiler seems to disagree.

And, unlike the customer, the compiler is ALWAYS right.

you can check the codes that mucked up include line does not exist at all !

Your code should look something like this

#define constantName value

what you have done looks more like this

#define constantNamevalue you need the whitespace.

it does not have something like what the error shows i don't know why it cannot be uploaded .

The error message seems to clearly show that the problem starts in the file SoftwareServo.h which you have included in your sketch

Since you haven't shown us any code that includes that library there's no point us trying to look at it or compile the stuff you have posted. All I can guess is that you have a bad version of the SoftwareServo library.

And just for interest, why are you using SoftwareServo instead of the standard included Servo library?

Steve

i have attached the codes you can check them there is nothing like the codes that the compiler shows it as error
And the code is no written by me that is why i don't clearly know why the author is using SoftwareServo instead of the standard one.