Go Down

Topic: Testing for LCD Screen (Read 104 times) previous topic - next topic

BlackDay

I want to create a program where if a LCD screen is connected, the program prints to that. If it isn't connected, I want it to continue on with the program and just print in the Serial monitor. I am using the Adadfruit backpack to connect an I2C. I got the LCD working with the library on the adafruit page. When I disconnect the LCD, the program doesn't run at all. I don't get any message saying it is not connected which is what happens with the other sensors I have used. Any help? I am using a Arduino nano and sometimes a Arduino Mega.

bperrybap

You could use my hd44780 library package instead.
It will auto detect the backpack and self configure itself.
The begin() call will return a status as to whether or not the initialization was successful. You can use this to detect if the backpack is there. (begin() will fail and return a failure status if the backpack is not present)
The hd44780 library is MUCH faster than the Adafruit library.
It can be installed using the IDE library manager.
You can read more about it here: https://github.com/duinoWitchery/hd44780
The i/o class for the backpack when using i2c is hd44780_I2Cexp.
You can run the included diagnostic sketch I2CexpDiag to test the connections and that library is properly auto detecting the backpack. It will test the i2c connections and the internal memory of the LCD.

--- bill

Go Up