Skip to main content

Serial LCD library

Posted in

Don't know what I'm doing wrong, but when I try your serial LCD library with a float I get:

lcd_example.cpp: In function ‘void setup()’:
lcd_example:25: error: call of overloaded ‘print(float&, int)’ is ambiguous
/Arduino/sketchbook/libraries/SparkSoftLCD/SparkSoftLCD.h:57: note: candidates are: void SparkSoftLCD::print(long int, int)
/Arduino/sketchbook/libraries/SparkSoftLCD/SparkSoftLCD.h:58: note: void SparkSoftLCD::print(float, uint8_t)

This is the offending code:
/*
Example of using the SparkSoftLCD library for the Arduino
2010 C. A. Church
http://openmoco.org/
*/
#include "SparkSoftLCD.h"
// LCD transmit pin
#define LCD_TX 4
SparkSoftLCD lcd = SparkSoftLCD(LCD_TX);
void setup() {
// setup lcd
pinMode(LCD_TX, OUTPUT);
lcd.begin(9600);
lcd.clear();
float b=3.14;
lcd.print(b,2);
delay(1000);
}
void loop() {
}

The example code works fine - just floats are a problem.

Thanks!

itsthemedication, Try

itsthemedication,

Try this:

float foo = 0.1;
lcd.print(foo, (byte) 2);

It seems that the problem is that the compiler is trying to be smart, and is mapping your bare '2' argument to an int, and then it's getting confused about how to handle it. I'll try and see if I can disambiguate it, but it would probably require a new method which would be more or less confusing depending on who you ask =)

!c

Thanks for the reply! Not a

Thanks for the reply! Not a problem. Can live with that...

Great library, but I think I

Great library, but I think I found a bug. It seems necessary to have to insert a delay after calling the backlight() function. 1500 ms worked for me. Without it the LCD seemed to be put into an unknown state, requiring a power cycle to work again.

I found that out too, the

I found that out too, the long hard way. 2ms proved to be sufficient.
I sent my version of the library to shutterdrone, got not feedback. If he doesn't, I'll publish my version soon.

Sorry guys, I've been heavily

Sorry guys, I've been heavily slammed - not to mention the dronecolony address is a spam trap these days, hard to sort out the good stuff from the noise.

Send it to church at dynamicperception dot com, and I'll get it incorporated.

!c