3 # Virtual Serial Port API Example
6 # XXX Set this to match your virtual serialport
7 # TODO Show examples for Mac OSX and Cygwin/Windows
8 SERIALPORT=/dev/ttyACM0
10 # NOTE: Make sure you don't write too quickly to the serial port, it can get overwhelmed by a modern computer
11 # Generally this just means commands will get ignored
12 # I'm using 100 ms sleeps here, but much smaller are probably sufficient
14 # Clear out cli buffer
15 printf "\r" > $SERIALPORT
17 # Change backlight color
18 # 3 16-bit numbers (hex or decimal) Red, Green and Blue
20 printf "lcdColor 0x100 0x2000 0x4000\r" > $SERIALPORT # Light blue
22 # Change the lcd image
26 # - pixels (1 bit per pixel)
28 # There are 9 total pages of display memory, but only 4 are visable at time (it is possible to scroll though)
29 # Each page is 128 bits wide (16 bytes)
30 # See the datasheet for full details http://www.newhavendisplay.com/specs/NHD-C12832A1Z-FSRGB-FBW-3V.pdf
32 printf "lcdDisp 0x0 0x0 0xFF 0x13 0xFF 0x11 0xFF\r" > $SERIALPORT
34 printf "lcdDisp 0x1 0x10 0xFF 0x13 0xFF 0x11 0xFF 0x44\r" > $SERIALPORT
36 printf "lcdDisp 0x2 0x20 0xFF 0x13 0xFF 0x11 0xFF\r" > $SERIALPORT
38 printf "lcdDisp 0x3 0x30 0xFF 0x13 0xFF 0x11 0xFF\r" > $SERIALPORT
40 # Send command directly to the lcd
41 # See the datasheet for full details http://www.newhavendisplay.com/specs/NHD-C12832A1Z-FSRGB-FBW-3V.pdf
43 printf "lcdCmd 0xA7\r" > $SERIALPORT # Reverse display (0xA6 is Normal)