I trying to display temperature and humidity on a LCD48
84 module. the temperature reading function returns a float, the lcd module expects a string. The floatToString function returns the result as char * name. My code is thus:
[code]#include "LCD4884.h"
#include "DFrobot_bmp.h"
#include <SHT1x.h>
#define dataPin 10 // DATA
#define clockPin 11 // SCK
SHT1x sht1x(dataPin, clockPin);
#include "floatToString.h" //set to whatever is the location of floatToStrig
// menu starting points
#define MENU_X 10 // 0-83
#define MENU_Y 1 // 0-5
int adc_key_val[5] ={50, 200, 400, 600, 800 };
void setup(){
lcd.LCD_init();
lcd.LCD_clear();
Serial.begin(9600);
}
/* loop */
void loop()
{
float temp_f;
float humidity;
// Read values from the sensor
char tempString[25]; // just give it plenty to write out any values you want to test
temp_f = sht1x.readTemperatureF();
Serial.println("floatToString(tempString, temp_f , 4);");
tempString += " F"
lcd.LCD_write_string_big(15,1,tempString,MENU_NORMAL);*/
humidity = sht1x.readHumidity();
// lcd.LCD_write_string_big(15,1,
}
The error I get is:
TEMP_HUM_LCD.cpp: In function ‘void loop()’:
TEMP_HUM_LCD:40: error: invalid operands of types ‘char [25]’ and ‘const char [3]’ to binary ‘operator+’
TEMP_HUM_LCD:40: error: in evaluation of ‘operator+=(char [25], const char [3])’
TEMP_HUM_LCD:41: error: expected `;’ before ‘lcd’
TEMP_HUM_LCD:41: error: expected primary-expression before ‘/’ token
I’m still a newbie, unsure of where to go from here!
Jim[/code]