I'm trying to do this (seemingly) simple little project on my raspberry pi. I have a 16x2 LCD display, and I want to be able to input some text from a webpage and have it show up on the LCD.
I have this simple html webpage where I'm trying to get the input from a user:
<!DOCTYPE html>
<head>
<title>Text Input</title>
</head>
<body>
<form action="index.php">
Line One:<br>
<input type="text" name="line1"><br>
Line Two:<br>
<input type="text" name="line2"><br>
<input type="submit" value="Submit">
</form>
<?php
// runs script and inputs 2 lines
?>
</body>
And the python is fairly simple, where line1 and line2 would be replaced by whatever is input.
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
import os
line1 = "Line One"
line2 = "Line Two"
os.chdir('/home/pi/lcd')
import lcd
lcd.lcd_init()
lcd.lcd_byte(lcd.LCD_LINE_1, lcd.LCD_CMD)
lcd.lcd_string(line1,2)
lcd.lcd_byte(lcd.LCD_LINE_2, lcd.LCD_CMD)
lcd.lcd_string(line2,2)
lcd.GPIO.cleanup()
I just don't know how to get the information from the webpage to the python script. I know that from php, you can use exec() to do commands, but even then, I'm not sure how you would get the data from the command line into the python script.