code to display text on an i2c LCD disply with attiny devices
Place the files in your project directory and add #include "attiny_lcd.h"
to your main .c file
This project also requires attiny_i2c.c
and attiny_i2c.h
from my other repo.
The SDA pin
is set as PB0
and the SCL pin
is set as PB2
. This can be changed in attiny_i2c.h
The address for the LCD display is set as 0x20
. This can be changed in attiny_lcd.h
Setup your display.
print the string at *str
on the screen (cursor position is not changed before printing).
print two string onto the two lines of the display. (cursor is set to the beginning of each line before printing)
Switch On/Off the backlight of your display.
true: Switch on backlight
false: Switch off backlight
Shift the text on screen by count
units left or right.
SHIFT_LEFT: shift text by count
units to the left.
SHIFT_RIGHT: shift text by count
units to the right.
Change the display settings.
CURSOR_LEFT: 0b00010000
CURSOR_RIGHT: 0b00010100
SHIFT_LEFT: 0b00011000
SHIFT_RIGHT: 0b00011100
LINE_1: 0b10000000
LINE_2: 0b11000000