Please Help! multiple DS18B20 sensors ,I2C LCD 20x4
hello !
im trying use 4 ds18b20 sensors 20x4 i2c lcd , if i'll add more 2 sensors doesn't display third , fourth sensor . tried same sketch using serial monitor , works fine
i'm lost because i'm not sure if if that's hardware or software problem.
any appreciated!
here's code
im trying use 4 ds18b20 sensors 20x4 i2c lcd , if i'll add more 2 sensors doesn't display third , fourth sensor . tried same sketch using serial monitor , works fine
i'm lost because i'm not sure if if that's hardware or software problem.
any appreciated!
here's code
code: [select]
#include <onewire.h>
#include <dallastemperature.h>
#include <liquidcrystal_i2c.h>
#include <wire.h>
#define one_wire_bus 10
liquidcrystal_i2c lcd(0x27,20,4);
onewire onewire(one_wire_bus);
dallastemperature sensors(&onewire);
void setup() {
lcd.init(); // initialize lcd
lcd.backlight();
sensors.begin();
}
void loop() {
sensors.requesttemperatures();
lcd.setcursor(0, 0);
lcd.print("sensor 1:");
lcd.print(sensors.gettempcbyindex(0));
lcd.print((char)223);
lcd.print("c");
lcd.setcursor(0, 1);
lcd.print("sensor 2:");
lcd.print(sensors.gettempcbyindex(1));
lcd.print((char)223);
lcd.print("c");
lcd.setcursor(0, 2);
lcd.print("sensor 3 :");
lcd.print(sensors.gettempcbyindex(1));
lcd.print((char)223);
lcd.print("c");
lcd.setcursor(0, 3);
lcd.print("sensor 4 :");
lcd.print(sensors.gettempcbyindex(1));
lcd.print((char)223);
lcd.print("c");
}
is there reason have
lcd.print(sensors.gettempcbyindex(0))
lcd.print(sensors.gettempcbyindex(1))
for first 2 lines then
lcd.print(sensors.gettempcbyindex(1))
and
lcd.print(sensors.gettempcbyindex(1))
for third , fourth lines? ie, same line two.
maybe meant ....index(2). , .....index(3).
weedpharma
lcd.print(sensors.gettempcbyindex(0))
lcd.print(sensors.gettempcbyindex(1))
for first 2 lines then
lcd.print(sensors.gettempcbyindex(1))
and
lcd.print(sensors.gettempcbyindex(1))
for third , fourth lines? ie, same line two.
maybe meant ....index(2). , .....index(3).
weedpharma
Arduino Forum > Using Arduino > Sensors > Please Help! multiple DS18B20 sensors ,I2C LCD 20x4
arduino
Comments
Post a Comment