1602 LCD on RPi B+: Difference between revisions

Jump to navigation Jump to search
Line 44: Line 44:
70: -- -- -- -- -- -- -- --                         
70: -- -- -- -- -- -- -- --                         
</syntaxhighlight>
</syntaxhighlight>
* Install neccesary software
<syntaxhighlight lang="text">
sudo apt-get install python-smbus
mkdir ~/lcd
cd ~/lcd
git clone https://bitbucket.org/thinkbowl/i2clibraries.git
</syntaxhighlight>
* Add main script, "vi ~/lcd/main.py"
<syntaxhighlight lang="python">
#!/usr/bin/python
from i2clibraries import i2c_lcd_smbus
lcd = i2c_lcd_smbus.i2c_lcd(0x27,1, 2, 1, 0, 4, 5, 6, 7, 3)
lcd.command(lcd.CMD_Display_Control | lcd.OPT_Enable_Display)
lcd.backLightOn()
lcd.writeString("Raspberry Pi")
lcd.setPosition(2, 0)
lcd.writeString("Rules!")
</syntaxhighlight>
* Everything should works fine now!

Navigation menu