So I’m trying to create a temperature gauge using a Seeeduino V4.2, the LCD RGB Backlight, and the High Temp sensor. I know that the LCD uses I2C and that the Temp sensor is analog but I can’t seem to get them both working at the same time. The LCD basically freezes up when the temp sensor is plugged in either the second I2C port or the UART port.
Is this because the analog signal is interfering with the I2C data?
I can get the temp to read through the serial monitor if the LCD isn’t plugged in, or the LCD working with the code below if the temp sensor isn’t plugged in.
Is there anyway to get them both to work at the same time? The code below is basically my starting point for my future project.
Thanks!
[code]#include <Wire.h>
#include “rgb_lcd.h”
#include “High_Temp.h”
rgb_lcd lcd;
HighTemp ht(A4, A5);
void setup()
{
// set up the LCD’s number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print(“Fade/Temp Demo”);
ht.begin();
}
void breath(unsigned char color)
{
for(int i=10; i<255; i++)
{
lcd.setPWM(color, i);
delay(5);
}
lcd.setCursor(0, 1);
lcd.print("Temp = ");
lcd.setCursor(7, 1);
lcd.print(ht.getThmc());
for(int i=254; i>=10; i--)
{
lcd.setPWM(color, i);
delay(5);
}
}
void loop()
{
breath(REG_RED);
breath(REG_GREEN);
breath(REG_BLUE);
}
[/code]