Neat method!
Did you mean digits[4] instead of char[4]? it yelled at me about that
Here's what I have now:
char* intToChar(int value) {
char digits[5] = {' ',' ',' ',' ',' '};
while(value > 0) {
digits[4]=(char)((value%10)+48);
value=value/10;
digits[3]=(char)((value%10)+48);
value=value/10;
digits[2]=(char)((value%10)+48);
value=value/10;
digits[1]=(char)((value%10)+48);
value=value/10;
digits[0]=(char)((value%10)+48);
}
return digits;
}
...
lcd.print(intToChar(1));
The error it gives me is:
In function 'void loop()':
error: invalid conversion from 'char*' to 'int
I tried
lcd.print((char)intToChar(1));
and
lcd.print((char*)intToChar(1));
But no luck ![]()
Thanks!!