As I am new with Arduino coding and I2C LCD displays, can anyone lend a hand please and share helpful thermistor codes for I2C LCD display. Thank you very much
#include<math.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F, 16, 2);
double Thermister(int data)
{
double temp;
temp=log(10000.0*((1024.0/data-1)));
temp=1/(0.001129148+(0.000234125+(0.0000000876741temptemp))temp);
temp=temp-273.15;
Serial.println(" ");
Serial.print(temp);
Serial.print(" Celcius");
lcd.setCursor(0,0);
lcd.print("Temp = ");
lcd.print(temp);
lcd.print(" C");
temp=(temp9.0)/5.0+32.0;
Serial.println(" ");
Serial.print(temp);
Serial.print(" Fahrenheit");
Serial.println(" ");
Serial.println("..................................");
lcd.setCursor(0,1);
lcd.print("Temp = ");
lcd.print(temp);
lcd.print(" F");
}
void setup()
{
Serial.begin(9600);
lcd.begin();
lcd.backlight();
}
int i;
void loop()
{
i=analogRead(A0);
Thermister(i);
delay(1000);
}
Coding at the top was the one I used but did not seem to work while uploading it to IDE.
but did not seem to work while uploading it to IDE.
What is the problem? The above does not contain any information that we can use to help you.
Read the how to use this forum-please read sticky to see how to, properly, post code and some advice on how to ask a good question. You have left out information that we need in order to help you. Format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code.
There is a better I2C LCD library. The hd44780 library is the best available at this time. For an I2C LCD display to work, the I2C address and the I2C backpack to LCD pin mapping must be correct. If the library default settings for either or both are not correct the LCD will not work. You can try to figure out the right pin mapping and use an I2C scanner to find the address, but if you install and use the hd44780 library that is done automatically by the library.
Install the hd44780 library. The hd44780 library is the best available for I2C LCDs. The library is available in the Library Manager. Go to Library Manager (in the IDE, Sketch, Include Libraries, Manage Libraries) and in the Topics dropdown choose Display and in the Filter your search box enter hd44780. Select and install the hd44780 library by Bill Perry.
The class that you want to use is the hd44780_I2Cexp class. There are examples to show how to use the library. The nice thing about the hd44780 library is that it will autodetect the I2C address and the I2C backpack to LCD pin mapping.
In the examples, there is a diagnostic sketch that will help us to help you if you still have trouble with the display. Run the diagnostic sketch and post the results.
After installing the hd44780 library, the first thing to run is the included diagnostic sketch: I2CexpDiag.
That will run tests to make sure everything is working.
Once that passes, then move on to other things like other hd44780_I2Cexp i/o class examples, and then your own sketch code using the library.
--- bill