lcd.write will only send one byte to the lcd, it is the basic mechanism
Actually, this is incorrect.
the write() function is overloaded.
There are 3 versions of write()
- write(unsigned char
) outputs a single byte.
- write(const char * str
) which is assumed to be a pointer to a C string
so the function will output all the characters in the in the C string pointed to by the pointer.
- write(const uint8_t *buffer, size_t size
) which outputs the specified number of bytes
starting at the buffer pointer.
The standard LiquidCrystal library (which appears to be what is being used) supports
It isn't clear what the intent of this code is and it
looks like it may not do what is probably expected:
void Output(float headingDegrees)
Serial.println(" Degrees \t");
It prints some information on the serial port then
after waiting 900ms (just less than 1 second), it will then call Serial.read() to read a single character
from serial port buffer.
The read() function returns either 1 single character from the UART/Serial buffer or -1 if no characters are in the buffer.
Serial.read() is not blocking i.e. it will not wait for input. It will immediately return with either a single character from
the RX buffer or a -1 if none are available.
If no character is available the -1 or 0xffff will be passed to lcd.write(), lcd.write() is only looking
at the lower 8 bits so it will end up sending a 0xff to the LCD. A 0xff on many hd44780 displays
will be full block of pixels.
So this Output() function seems very strange to me.
It outputs some information to the serial port, then it tries to read a single character from the serial port.
If there is a character in the serial RX buffer, the character is pushed to the lcd, if there is no character
in the serial RX buffer, a 0xff is send to the lcd which on most lcds will be a full block of pixels.
I'm assuming this is not the desired behavior.