To install python-bottle on Raspberry Pi, refer to the post "Python + bottle@Raspberry Pi: Web based GPIO control".
The previouse post "2x16 LCD Display on Raspberry Pi" show how to connect and text 2x16 LCD Module on Raspberry Pi. To control the LCD Module with Python, the program Adafruit_CharLCD.py in the post is needed.
weblcd.py
from bottle import route, run
from bottle import post, request
from Adafruit_CharLCD import Adafruit_CharLCD
lcd = Adafruit_CharLCD()
host = '192.168.1.105'
@route('/')
def index():
return '''
'''
@route('/', method='POST')
def do_msg():
msg = request.forms.get('msg')
lcd.clear()
lcd.message(msg)
return index()
lcd.clear()
lcd.message("Hello:\n Raspberry Pi")
run(host=host, port=80)
Download HERE.
0 تعليقات