hddforensic:
Hi Bill,When I found the code it was written with "write" but I got an error message
saying, call of overloaded 'write(int)' is ambiguous
Yes, I thought you might run into that issue.
I should have mentioned that the way the Arduino boys created the Print class there is an issue when you use
write(0);
(They have been asked to fix this but have so far have refused)
zero is special in C/C++ due to some historical reasons. zero is an int and because of this, the compiler wants to use a function that accepts an int. There is no write() function in the Print class that accepts an int.
As a result, you get this error.
The solution is to cast the argument like this.
lcd.write((uint8_t) 0);
That will tell the compiler to treat the 0 as a uint8_t and then it can find the appropriate function.
This is only an issue for zero not other values.
Also, if you use a variable of uint8_t and assign it zero, it isn't an issue.
i.e.
uint8_t val;
val = 0;
lcd.write(val);
The arduino boys could fix this issue in their code, why they have refused to fix this over the years makes no sense to me.
They have spent more time and effort explaining and documenting how to work around the issue rather than just adding 1 line of code to their Print class to fix it once and for all.
There is a mention of this on the LiquidCrystal library createChar page:
I am so sick of this issue that I have added a work around my hd44780 library and the next release, which should be available in a few days, will not have this issue.
So with the next release of my hd44780 library you will be able to use
lcd.write(0);
with no issue.
--- bill