Trying to implement a library and keep getting this error message

I’m working on my final project for my class and I needed to install a library so I could use my DHT sensor. So I installed it and I used this tutorial to help me program it and now it won’t compile and I keep getting this error message.

"Arduino: 1.8.5 (Windows 10), Board: “Arduino/Genuino Uno”

In file included from C:\Users\noah-\Documents\Arduino\libraries\DHT_sensor_library\DHT_U.cpp:22:0:

C:\Users\noah-\Documents\Arduino\libraries\DHT_sensor_library\DHT_U.h:25:29: fatal error: Adafruit_Sensor.h: No such file or directory

#include <Adafruit_Sensor.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.
"

here is my code too

I know it’s long :o

#include <DHT.h>         // include the temperature sensor library

#define dataPin 8         // define pin 8 as the data pin for the temperature sensor
dht DHT;                  

int motor = 9;            // set pin 9 as the motor pin
int button = 2;           // set pin 2 as the button pin
int photocell = A0;       // set analog pin A0 as the photocell pin
int led[7] = {3, 4, 5, 6, 7, 10, 11}; // set the 3-7 and 10-11 pins as leds
int product = 0;          // set up a counter for the products

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);     // start the serial monitor
  pinMode(motor, OUTPUT); // set motor as an output
  pinMode(button, INPUT); // set button as an input
  pinMode(led[], OUTPUT); // set leds as outputs
}

void loop() {
  // put your main code here, to run repeatedly:
  int readData = DHT.read22(dataPin); // set up an integer equal to the data pin data
  float t = DHT.temperature;  // float temperature
  float h = DHT.humidity;     // float humidity

  for (int part = 0; part < 2; part++)  // set up a for loop to manufacture two parts
  {
    digitalWrite(motor, HIGH);          // start the conveyor
    heatTreatment();                    // heat treat the part
    OperatorInput();                    // operator pushes button that operates a machine that works on the part
    Painting();                         // paint the part
    digitalWrite(motor, LOW);           // stop when the part is at the end of the other conveyor so it can wait for the second part
    Serial.println("I recieved");       // print how many parts are at the end and are waiting on another
    Serial.print(part);
    Serial.print(" amount of parts");
    digitalWrite(led[7], HIGH);         // turn on the 4th red led to indicate that a part is waiting for its other half to come before continuing
    if (part = 2)
    {
      product++;
      digitalWrite(motor, HIGH);        // when the two parts are together on the warehouse conveyor start the warehouse conveyor motor
      Serial.print("I recieved");
      Serial.print(product);
      Serial.print(" amount of products");
      digitalWrite(led[7], LOW);        // turn off the 4th red led to indicate that the two parts were merged into one product and moved to the warehouse
    }
  }
}
void heatTreatment()
{
  digitalWrite(motor, LOW);     // turn off the conveyor when the part arives
  digitalWrite(led[1], HIGH);   // turn on the 1st red led to indicate that the first process has recieved the part
  Serial.print("Temperature = ");
  Serial.print(t);              // print Temperature = *C in the serial monitor
  Serial.print("*C");
  delay(2000);
  Serial.println("heat treatment complete");      // indicate that the heat treatment is complete
  digitalWrite(led[1], LOW);                      // turn off the 1st red led
  digitalWrite(led[2], HIGH);                     // turn on the 1st green led
  digitalWrite(motor, HIGH);                      // turn the conveyor back on and move part to next process
}

void OperatorInput()
{
  digitalWrite(motor, LOW);             // turn off the conveyor when the part arrives
  digitalWrite(led[3], HIGH);           // turn on the 2nd red led to indicate that the operator recieved the part
  int buttonState = digitalRead(button); // set an integer = to the buttonstate (pressed or not pressed)
  if (buttonState = HIGH)
  {
    delay(1000);      // ghetto debounce
    Serial.println("OPERATION IN PROGRESS");  // print that the operation is in progress
    delay(2000);                              // wait two seconds
    Serial.println("OPERATION COMPLETE");     // print that the operation is complete
    digitalWrite(motor, HIGH);                // turn the conveyor back on 
    digitalWrite(led[3], LOW);                // turn the 2nd red led off
    digitalWrite(led[4], HIGH);               // turn the 2nd green led on to indicate that this process is complete
  }

}

void Painting()
{
  int analogValue = analogRead(A0);   // set an integer equal to the analog value of the photocell
  digitalWrite(motor, LOW);   // turn off the conveyor
  digitalWrite(led[5], HIGH); // turn on the 3rd red led to indicate that the painting process has recieved the part
  if (analogValue < 100)
  {
    Serial.println("Painting HAS BEGUN");   // if the light value is less that 100 print that the painting process has begun
    delay(2000);                            // wait two seconds
    Serial.println("PAINTING HAS FINISHED");  // print that the painting process has finished 
    digitalWrite(motor, HIGH);              // turn the conveyor back on
    digitalWrite(led[5], LOW);              // turn off the 3rd red led
    digitalWrite(led[6], HIGH);             // turn on the 3rd green led to indicate that the last process has completed
  }
}
Adafruit_Sensor.h: No such file or directory

Error messages don't get any more straight forward than that. Have you got that file? Where is it on your machine?

Okay i checked for any libraries i was missing and downloaded the one i needed for my sensor and im still getting the same error message

Arduino: 1.8.5 (Windows 10), Board: “Arduino/Genuino Uno”

Build options changed, rebuilding all
In file included from C:\Users\noah-\Documents\Arduino\libraries\DHT_sensor_library\DHT_U.cpp:22:0:

C:\Users\noah-\Documents\Arduino\libraries\DHT_sensor_library\DHT_U.h:25:29: fatal error: Adafruit_Sensor.h: No such file or directory

#include <Adafruit_Sensor.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.

#include <DHT.h>
#include <DHT_U.h>

#include <Adafruit_Sensor.h>
#include <DHT.h>         // include the temperature sensor library

#define dataPin 8         // define pin 8 as the data pin for the temperature sensor
dht DHT;                  

int motor = 9;            // set pin 9 as the motor pin
int button = 2;           // set pin 2 as the button pin
int photocell = A0;       // set analog pin A0 as the photocell pin
int led[7] = {3, 4, 5, 6, 7, 10, 11}; // set the 3-7 and 10-11 pins as leds
int product = 0;          // set up a counter for the products

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);     // start the serial monitor
  pinMode(motor, OUTPUT); // set motor as an output
  pinMode(button, INPUT); // set button as an input
  pinMode(led[], OUTPUT); // set leds as outputs
}

void loop() {
  // put your main code here, to run repeatedly:
  int readData = DHT.read22(dataPin); // set up an integer equal to the data pin data
  float t = DHT.temperature;  // float temperature
  float h = DHT.humidity;     // float humidity

  for (int part = 0; part < 2; part++)  // set up a for loop to manufacture two parts
  {
    digitalWrite(motor, HIGH);          // start the conveyor
    heatTreatment();                    // heat treat the part
    OperatorInput();                    // operator pushes button that operates a machine that works on the part
    Painting();                         // paint the part
    digitalWrite(motor, LOW);           // stop when the part is at the end of the other conveyor so it can wait for the second part
    Serial.println("I recieved");       // print how many parts are at the end and are waiting on another
    Serial.print(part);
    Serial.print(" amount of parts");
    digitalWrite(led[7], HIGH);         // turn on the 4th red led to indicate that a part is waiting for its other half to come before continuing
    if (part = 2)
    {
      product++;
      digitalWrite(motor, HIGH);        // when the two parts are together on the warehouse conveyor start the warehouse conveyor motor
      Serial.print("I recieved");
      Serial.print(product);
      Serial.print(" amount of products");
      digitalWrite(led[7], LOW);        // turn off the 4th red led to indicate that the two parts were merged into one product and moved to the warehouse
    }
  }
}
void heatTreatment()
{
  digitalWrite(motor, LOW);     // turn off the conveyor when the part arives
  digitalWrite(led[1], HIGH);   // turn on the 1st red led to indicate that the first process has recieved the part
  Serial.print("Temperature = ");
  Serial.print(t);              // print Temperature = *C in the serial monitor
  Serial.print("*C");
  delay(2000);
  Serial.println("heat treatment complete");      // indicate that the heat treatment is complete
  digitalWrite(led[1], LOW);                      // turn off the 1st red led
  digitalWrite(led[2], HIGH);                     // turn on the 1st green led
  digitalWrite(motor, HIGH);                      // turn the conveyor back on and move part to next process
}

void OperatorInput()
{
  digitalWrite(motor, LOW);             // turn off the conveyor when the part arrives
  digitalWrite(led[3], HIGH);           // turn on the 2nd red led to indicate that the operator recieved the part
  int buttonState = digitalRead(button); // set an integer = to the buttonstate (pressed or not pressed)
  if (buttonState = HIGH)
  {
    delay(1000);      // ghetto debounce
    Serial.println("OPERATION IN PROGRESS");  // print that the operation is in progress
    delay(2000);                              // wait two seconds
    Serial.println("OPERATION COMPLETE");     // print that the operation is complete
    digitalWrite(motor, HIGH);                // turn the conveyor back on 
    digitalWrite(led[3], LOW);                // turn the 2nd red led off
    digitalWrite(led[4], HIGH);               // turn the 2nd green led on to indicate that this process is complete
  }

}

void Painting()
{
  int analogValue = analogRead(A0);   // set an integer equal to the analog value of the photocell
  digitalWrite(motor, LOW);   // turn off the conveyor
  digitalWrite(led[5], HIGH); // turn on the 3rd red led to indicate that the painting process has recieved the part
  if (analogValue < 100)
  {
    Serial.println("Painting HAS BEGUN");   // if the light value is less that 100 print that the painting process has begun
    delay(2000);                            // wait two seconds
    Serial.println("PAINTING HAS FINISHED");  // print that the painting process has finished 
    digitalWrite(motor, HIGH);              // turn the conveyor back on
    digitalWrite(led[5], LOW);              // turn off the 3rd red led
    digitalWrite(led[6], HIGH);             // turn on the 3rd green led to indicate that the last process has completed
  }
}

Delta_G:
Have you got that file? Where is it on your machine?

Okay i got that library now and now im getting a different message

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

C:\Users\noah-\Documents\Arduino\sketch_jun11a\sketch_jun11a.ino: In function 'void loop()':

sketch_jun11a:25: error: expected primary-expression before '.' token

int readData = DHT.read22(dataPin); // set up an integer equal to the data pin data

^

sketch_jun11a:26: error: expected primary-expression before '.' token

float t = DHT.temperature; // float temperature

^

C:\Users\noah-\Documents\Arduino\sketch_jun11a\sketch_jun11a.ino: In function 'void heatTreatment()':

sketch_jun11a:55: error: 't' was not declared in this scope

Serial.print(t); // print Temperature = *C in the serial monitor

^

exit status 1
expected primary-expression before '.' token

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

Hello, I'm not a good programmer but can you try this putting the float t line in your function like below.

void heatTreatment()
{
  float t = DHT.temperature;  // float temperature
  digitalWrite(motor, LOW);     // turn off the conveyor when the part arives
  digitalWrite(led[1], HIGH);   // turn on the 1st red led to indicate that the first process has recieved the part
  Serial.print("Temperature = ");
  Serial.print(t);              // print Temperature = *C in the serial monitor
  Serial.print("*C");
  delay(2000);
  Serial.println("heat treatment complete");      // indicate that the heat treatment is complete
  digitalWrite(led[1], LOW);                      // turn off the 1st red led
  digitalWrite(led[2], HIGH);                     // turn on the 1st green led
  digitalWrite(motor, HIGH);                      // turn the conveyor back on and move part to next process
}

Nevermind i got it to work with a little more tinkering thanks for the help guys

NC_Mechatronics:
Nevermind i got it to work with a little more tinkering thanks for the help guys

Don't be rude. Someone else might have a similar problem. Show the solution too. This exercise wasn't just all about you.