Getting wrong display using concatentation

43 Views Asked by At

I'm using the LCD library and some custom characters on an Arduino.

The line

lcd.print(char(0) + char(1) + char(6) + char(1) + char(1) + char(2) + ' ' + char(0) + char(1) + char(1) + ' ' + char(0) + char(1) + char(1) + char(2) + ' ' + char(0) + char(1) + char(1) + char(2));

should display a series of custom characters, but instead just shows

117

What have I done wrong. I'm fairly new to C/C++ but have used C# a lot.

1

There are 1 best solutions below

0
On

Ok, I solved this by dint of creating an array of chars, and passing that to a function which calls lcd.write() in a loop using each element of the array. Not ideal, but it works.