Created
January 5, 2013 06:56
-
-
Save slayerjay/4460208 to your computer and use it in GitHub Desktop.
Arduino and Python Serial Connection with LCD (http://cyberasylum.janithw.com/arduino-and-python-serial-connection-with-lcd/)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// include the library code: | |
#include <LiquidCrystal.h> | |
// initialize the library with the numbers of the interface pins | |
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); | |
void setup() { | |
Serial.begin(9600); | |
lcd.begin(16, 2); | |
lcd.print("start"); | |
} | |
void loop() { | |
if (Serial.available()) { | |
delay(100); //wait some time for the data to fully be read | |
lcd.clear(); | |
while (Serial.available() > 0) { | |
char c = Serial.read(); | |
lcd.write(c); | |
} | |
} | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import serial | |
import time | |
s = serial.Serial(11, 9600) #port is 11 (for COM12, and baud rate is 9600 | |
time.sleep(2) #wait for the Serial to initialize | |
s.write('Ready...') | |
while True: | |
str = raw_input('Enter text: ') | |
str = str.strip() | |
if str == 'exit' : | |
break | |
s.write(str) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment