I am trying to make a digital thermometer, which reads the temperature and humidity using a DHT11 sensor. I have tried to upload it to my Elegoo Mega2560 R3 board, but I constantly get the following error message:
Arduino: 1.8.3 (Windows Store 1.8.6.0) (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
mkdir sketch: Access is denied.
Error compiling for board Arduino/Genuino Mega or Mega 2560.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
I have checked my code many times and I don't understand what I am doing wrong. For this project, I have used the following code:
#include <dht.h> //Include DHT11 library
int dht = 7; //Set up DHT11 pin
#include <LiquidCrystal.h.> //Load LCD library
LiquidCrystal LCD(10, 9, 5, 4, 3, 2); //Create LCD object
void setup() {
Serial.begin(9600); //Turn on serial port
LCD.begin(16, 2); //Start LCD
LCD.setCursor(0, 0); //Set cursor
}
int convert(int tempInC){
return((tempInC * 9/5 + 32); //Calculate temperature in farenheit
}
void loop() {
int data = DHT.read11(dht); //Read data off of DHT_11
LCD.print("Temperature: ");
LCD.print(convert(dht.temperature));
LCD.print((char)223);
LCD.print(" ");
LCD.print("F");
LCD.print(" ("); //Print temperature in celsius and farenheit
LCD.print(dht.temperature);
LCD.print((char)223);
LCD.print(" ");
LCD.print("C");
LCD.print(")");
LCD.setCursor(0, 1);
LCD.print("Humidity: ");
LCD.print(DHT.humidity); //Print humidity in %
LCD.print("%");
delay(250); //Pause briefly
LCD.print(" "); //Clear line
}[code]
[/code]
Any help would be greatly appreciated. Thank you.