Notifications
Clear all

hey all temp sketch from here for lcd display

5 Posts
3 Users
0 Likes
546 Views
(@laserman)
Member
Joined: 2 years ago
Posts: 16
Topic starter  

from the site here https://dronebotworkshop.com/lcd-displays-arduino/ i have the Arduino LCD Keypad Shield with the buttons and would like to use the temp humid sketch for the above but have ran into a issue it will not complete the compile even though i think i have changed the code to use the shield but it errors and i only have the DHT-11 sensor at this time not the dht-22 can i get some ideas on where to fix the code


   
Quote
(@davee)
Member
Joined: 3 years ago
Posts: 1664
 

Hi @laserman,

  Sorry, but I think you need to give a some more information than that. In particular, a listing of  the exact code you have tried to compile and the precise error messages.

If there are a lot of error messages, then usually only the first 3-4 are likely to be helpful and needed ... at least to get rid of the first problem.

If you are copying code onto a forum page, please try to follow the instructions to ensure it retains the 'formatted' look, and use the 'preview' button to check what it will look like, before hitting ADD REPLY.

Good luck and best wishes, Dave


   
ReplyQuote
(@laserman)
Member
Joined: 2 years ago
Posts: 16
Topic starter  

thanks

heres the code 

/*
LCD Display with I2C Interface and DHT-22 Temp/Humid Sensor
lcd-i2c-temp-humid.ino
Use NewLiquidCrystal Library
Use DHT Libraries from Adafruit
DroneBot Workshop 2018
https://dronebotworkshop.com
*/

// Include Wire Library for I2C
#include <Wire.h>
// Include NewLiquidCrystal Library for I2C
#include <LiquidCrystal.h>

// Include DHT Libraries from Adafruit
// Dependant upon Adafruit_Sensors Library
#include "DHT.h";

// Define LCD pinout
//const int en = 2, rw = 1, rs = 0, d4 = 4, d5 = 5, d6 = 6, d7 = 7, bl = 3;
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

// Define I2C Address - change if reqiuired
//const int i2c_addr = 0x3F;

// DHT-21
#define DHTPIN 7 // DHT-21 Output Pin connection
#define DHTTYPE DHT21 // DHT Type is DHT 21 (AM2302)

// Define LCD display connections
//LiquidCrystal lcd( en, rw, rs, d4, d5, d6, d7, bl, POSITIVE);

// Define Variables
float hum; // Stores humidity value in percent
float temp; // Stores temperature value in Celcius

// Setup DHT sensor for normal 16mhz Arduino
DHT dht(DHTPIN, DHTTYPE);

void setup() {

// Set display type as 16 char, 2 rows
lcd.begin(16,2);

// Initialize DHT-21
dht.begin();
}

void loop()
{
delay(2000); // Delay so DHT-21 sensor can stabalize

hum = dht.readHumidity(); // Get Humidity value
temp= dht.readTemperature(); // Get Temperature value

// Clear the display
lcd.clear();

// Print temperature on top line
lcd.setCursor(0,0);
lcd.print("Temp: ");
lcd.print(temp);
lcd.print(" C");

// Print humidity on bottom line
lcd.setCursor(0,1);
lcd.print("Humid: ");
lcd.print(hum);
lcd.print(" %");

}

 

when i compile i get this error

C:\Users\jim\Downloads\KS0470 4WD BT Robot Car V2.0\3. Tutorial for Arduino\4. Test Code\lesson_1.1_LED_Blink\tempsense\tempsense.ino:17:17: warning: extra tokens at end of #include directive
#include "DHT.h";

 


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2507
 

@laserman 

It's complaining because there shouldn't be a ";" after #include "DHT.h"

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@laserman)
Member
Joined: 2 years ago
Posts: 16
Topic starter  

thanks


   
ReplyQuote