[Deleted]
The I2C scanners all use Wire.endTransmission() which hangs - which also remains unsolved.
You need to resolve this problem first. If there is a problem with the i2c bus then there is no way you can write to the lcd.
Does the i2c scanner code belolw hang up when you run it with nothing attached to the UNO. If it does, then there is most likely a problem with pin A4 or A5. Often it is an internal short with one of the pins. You can usually confirm defective pins by checking A4/A5 with analog read.
/ I2C Scanner
// Written by Nick Gammon
// Date: 20th April 2011
#include <Wire.h>
void setup() {
Serial.begin (115200);
// Leonardo: wait for serial port to connect
while (!Serial)
{
}
Serial.println ();
Serial.println ("I2C scanner. Scanning ...");
byte count = 0;
Wire.begin();
for (byte i = 8; i < 120; i++)
{
Wire.beginTransmission (i);
if (Wire.endTransmission () == 0)
{
Serial.print ("Found address: ");
Serial.print (i, DEC);
Serial.print (" (0x");
Serial.print (i, HEX);
Serial.println (")");
count++;
delay (1); // maybe unneeded?
} // end of good response
} // end of for loop
Serial.println ("Done.");
Serial.print ("Found ");
Serial.print (count, DEC);
Serial.println (" device(s).");
} // end of setup
void loop() {}
Surely during your searching you have learned which is the recommended library to use and you have also learned how to determine the correct constructor to use with that library. You should also have seen that it is essential to remove all of the other possibly conflicting libraries from your computer.
I could provide more specific information but in keeping with the spirit of your original post I won't.
You might want to look at this thread --> How to use this forum - please read <-- as well and provide some usable information when you return - otherwise any responses you may get will be pure speculation.
Don
Dingbats:
@ cattledog - thanks for the effort but it doesn't work
So do you comprehend what that tells you?
Do you understand that "it doesn't work" is meaningless in this context?
So that is the idea of test codes. Both codes explicitly told you that the I2C bus itself was not working, in which case you had a hardware problem which could not be solved by coding. ![]()
- not sure what you meant here - I'm looking for help, not more trouble.
What board are you using?
What display are you using?
What I2C adapter are you using?
What library are you using?
What sketch are you using?
What size pull-up resistors are you using?
Don