SHT11 to LCD problem..

Hi guys

I'm very new to the Arduino and apart from flashing LED's and mucking around with a parallel LCD, this is my first project..

What I am trying to do is use the Sensirion SHT11 temp/humidity sensor library and have changed the "serial print" to instead print the results on a LCD (using the 4-bit library)..

Unfortunately I get nothing printed on the LCD - I firstly built up circuit with the SHT11 and it worked fine displaying the serial info on the serial monitor (ie. Data = pin 2, Clk = pin 3). Then I hooked up the LCD as per the 4-bit library and confirmed this worked (ie. hello world).

Here is my combined code:

#include <LCD4Bit.h> 
LCD4Bit lcd = LCD4Bit(2); 

#include "Sensirion.h"

#define sensirionDataPin  2
#define sensirionClockPin 3 

float temperature;
float humidity;
float dewpoint;

Sensirion tempSensor = Sensirion(sensirionDataPin, sensirionClockPin); 

void setup()
{
  Serial.begin(9600);
  lcd.init();
}

void loop()
{
  tempSensor.measure(&temperature, &humidity, &dewpoint);

  Serial.print("Temperature: ");
  serialPrintFloat(temperature);
  Serial.print(" C, Humidity: ");
  serialPrintFloat(humidity);
  Serial.print(" %, Dewpoint: ");
  serialPrintFloat(dewpoint);
  Serial.println(" C");
  lcd.clear();
  delay (1000);
  lcd.print(temperature);

  delay(3000);  
}

void serialPrintFloat(float f){
  Serial.print((int)f);
  Serial.print(".");
  int decplace = (f - (int)f) * 100;
  Serial.print(abs(decplace));
}

Can anyone offer any suggestions as to what I am doing wrong..

Cheers

Hoops

You notice that the Serial Print for "temperature" gets diverted to a FLOAT conversion routine? You will need to do the same for the LCD print routine as well. You are trying to send the raw float value to the LCD routine which in turn is seeing that value and going "HUH?"

I kinda figured that was the problem..

I guess I need to learn a lot more about this - the problem is that I find the Arduino severely lacking in terms of any real "user manual"...

Hoops

True. We need some "offline" documents. As the kind of person that likes to sit down with a REAL book and read... I find the "Getting started with arduino" a little TOO sensitive to a newcomer to electronics (that's OK, but not for me) and the "arduino notebook" excellent but unfinished.

Sure, the concept is that this stuff continusously evolves online... but this old fart loves reference manuals... Oh well.

Anyway... You will need to create a similar wrapper routine that takes the float value and converts it to the ASCII equivalent so the LCD can print something useful.

Well.. I've come to a brick wall..

I have been doing searches on this for most of the day and can't find any solution..

Anyone?? Please... :-[

There is code for printing a floating point value to the serial port or lcd in this thread: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1207226548/13#13

In the Arduino, a float and double are the same thing.

Thanks mem..

I don't really understand it all and where to put it, but at least it gives me something to work on..

Can you suggest any good reading/sites that explain this a little better? Like I said, I am a total newbie at all of this - but VERY willing to learn..

Cheers

Hoops

I was trying to display temperature with a thermistor and display a decimal on the LCD. The link above, which I'll paste again: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1207226548/13#13 helped me get the right information printed to the LCD. I was getting a binary measurement on the LCD. When I did the float routine and used lcdPrintDouble to get the correct value to display on the LCD. It worked great, once I figured it out...

Bear in mind that support for printing floats has been added to release 0013. That means you can print floats/doubles in the Serial, Ethernet, and LiquidCrystal classes. It is limited to only doing two decimal places, so if you need more you either need to modify the library or use the code linked above.