Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Liquid Display i2c (Read 3020 times)
CJ
Newbies
*
Offline


Posts: 2
Joined: Oct 12th, 2018
Liquid Display i2c
Nov 16th, 2018 at 3:09am
Print Post  
I am using an Elegoo Nano with a DHT11 Sensor.  I want to connect a LGDehome IIC/I2C/TWI LCD 1602 16x2 Serial Interface Adapter to it. On the display,  I connected the black to ground, red to5 volts, SCL to A5 on the Nano, SDA to A4.  As you will see in the code, I also am running the DHT11 to a serial port on a monitor.  It seems to work well on the monitor , but nothing shows on the lcd. Below is my code:

Code/
Code
Select All
#include <LiquidCrystal_I2C.h>
#include <dht.h>
#include <Wire.h>
#define dht_apin A0 // Analog Pin sensor is connected to
dht DHT;
//#include <LiquidCrystal.h>

//LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
LiquidCrystal_I2C lcd(0x27, 16, 2);



void setup() {

  Serial.begin(9600);
  delay(1000                             );//Delay to let system boot
  Serial.println("DHT11 Humidity & temperature Sensor\n\n");
  delay(1000);//Wait before accessing Sensor                                                                                                            

}//end "setup()"

void loop() {
  //Start of Program

  DHT.read11(dht_apin);

  Serial.print("Current humidity = ");
  Serial.print(DHT.humidity);
  Serial.print("%  ");
  Serial.print("Temperature = ");
  //                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   Serial.print(DHT.temperature);
  Serial.print((int)round(1.8 * DHT.temperature + 32));
  Serial.println(" F ");

  delay(500);//Wait 5 seconds before accessing sensor again.
 // int chk = DHT.read11(dht_apin);
  lcd.setCursor(0,0);
  lcd.print("Temp: ");
  lcd.print(DHT.temperature);
  lcd.print((char)223);
  lcd.print("C");
  lcd.setCursor(0,1);
  lcd.print("Humidity: ");
  lcd.print(DHT.humidity);
  lcd.print("%");
  delay(1000);
  //Fastest should be once every two seconds.

}// end loop() 


/Code

What am I doing wrong???
Thanks

« Last Edit: Nov 16th, 2018 at 2:53pm by Tim@Visual Micro »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Liquid Display i2c
Reply #1 - Nov 16th, 2018 at 2:55pm
Print Post  
Hi,

This forum is really just support for the Visual Micro extension. Visual Micro remains compatible with the Arduino IDE so you would see the same issue with the Arduino IDE. This means that you can use the standard Arduino forums for support such as arduino.cc/forums or stackoverflow etc.

In this case I would recommend you always start with the examples that come with your library. In the LCD I2C examples you will see that they use lcd.begin() in the setup() to initialize the I2C connection

Code (C++)
Select All
void setup()
{
// initialize the LCD
	lcd.begin();

	// Turn on the blacklight and print a message.
	lcd.backlight();

} 

  
Back to top
WWW  
IP Logged
 
CJ
Newbies
*
Offline


Posts: 2
Joined: Oct 12th, 2018
Re: Liquid Display i2c
Reply #2 - Nov 16th, 2018 at 9:24pm
Print Post  
Thank you.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint