VS Arduino | |
Visual Micro >> General Board >> Liquid Display i2c
https://www.visualmicro.com/forums/YaBB.pl?num=1542337781 Message started by CJ on Nov 16th, 2018 at 3:09am |
Title: Liquid Display i2c Post by CJ on Nov 16th, 2018 at 3:09am
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]#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] /Code What am I doing wrong??? Thanks |
Title: Re: Liquid Display i2c Post by Visual Micro on Nov 16th, 2018 at 2:55pm
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++):
|
Title: Re: Liquid Display i2c Post by CJ on Nov 16th, 2018 at 9:24pm
Thank you.
|
VS Arduino » Powered by YaBB 2.6.12! YaBB Forum Software © 2000-2024. All Rights Reserved. |