Arduino + 3x DS18B20 + LCD + FAN


hello!

i trying make small project on arduino. want 3 temperature readings different computer parts, print on lcd (2x16) , use control 4 computer fans.

everything works fine now, except i've got strange signs on lcd. on other hands same data on serial correct.

can me?

code: [select]
#include <onewire.h>
#include <dallastemperature.h>
#include <liquidcrystal.h>

// data wire plugged pin 9 on arduino

#define one_wire_bus 9

int fan = 10;

// setup onewire instance communicate onewire devices
onewire onewire(one_wire_bus);
liquidcrystal lcd(7, 6, 5, 4, 3, 2);

// pass our onewire reference dallas temperature.

dallastemperature sensors(&onewire);


void setup(void)
{
lcd.begin(16, 2);
serial.begin(9600);
sensors.begin();

//set frequency of 9 & 10 pin on 32mhz
tccr1b = tccr1b & 0b11111000 | 0x01;
}

void loop(void)
{
float temp1=0, temp2=0, temp3=0;
serial.print("requesting temperatures...");
sensors.requesttemperatures();
delay(250);

serial.println("done");
lcd.clear();
lcd.setcursor(0,0);
temp1=sensors.gettempcbyindex(0);
lcd.print(temp1);
serial.println(temp1);

lcd.setcursor(8,0);
temp2=sensors.gettempcbyindex(1);
lcd.print(temp2);
serial.println(temp2);

lcd.setcursor(0,1);
temp3=sensors.gettempcbyindex(2);
lcd.print(temp3);
serial.println(temp3);

if ( (temp1 + temp2 + temp3)/3 > 22)
   {
   analogwrite(fan, 127);
   lcd.setcursor(8,1);
   lcd.print(127);
   }
else
   {
   analogwrite(fan, 0);
   lcd.setcursor(8,1);
   lcd.print(0);
   }
delay(500);
}




hello

do find solution?

bbye



Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Arduino + 3x DS18B20 + LCD + FAN


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums