Stage 4:
Suggested Reading
http://www.perceptualedge.com/library.php#Books
This builds upon the Dashboard v0.1 (Fall 2008), Dashboard v0.2 (Spring 2009) and Dashboard v0.3 (Spring 2009).
Work on this section began April 24, 2009.
The goals of this section are:
-
Convert the project from Phidgets to Arduino so the final product will be cheaper to produce.
-
Get an LCD screen displaying text using an Arduino (done)
-
Translate the GARSStoLCDv001.py to display on the Arduino LCD rather than Phidget LCD
Progress:
-
Able to write to the Arduino LCD screen (though it isn't as high level programming as the Phidgets LCD).
-
Garbage characters are sent to the screen when the LCD is connected to the data pin (TX) of the Arduino when the file is being uploaded from the computer. Keep it unplugged until file is uploaded.
-
Trying to get RSS parser for Twitter / Facebook / Weather Network to work:
http://blog.tinyenormous.com/2008/12/05/rss-parser-for-twitter/
-
Having troubles as I don't have a "serial" module installed for Python, which this code uses.
-
If I can get this to work it might give me some insight into how to improve the program I've already written, and will show me how to bridge sending data from a Python program to the Arduino LCD.
(Files in progress held in the /Python/Arduino LCD directory on the Lab PC).
Code
-
Learning2.pde (put on Arduino Diecimila, with Spark Fun Electronics SerLCD v2.5 LCD Screen connected to TX data pin and 5V, GND power pins)
-
Learning3.pde
-
Learning4.py (Attempt in Python - Not Working)
#Learning2.pde
void setup()
{
Serial.begin(9600);
delay(5000);
//backlightOn();
}
void loop()
{
Serial.print(0xFE, BYTE); //command flag
Serial.print(192, BYTE); //positions cursor at line 2.
Serial.print(40, BYTE); //ASCII code: "("
Serial.print(65, BYTE); //ASCII code: "A"
Serial.print(100, BYTE); //ASCII code: "d"
Serial.print(97, BYTE); //ASCII code: "a"
Serial.print(109, BYTE); //ASCII code: "m"
Serial.print(41, BYTE); //ASCII code: ")"
Serial.print(0xFE, BYTE); //command flag
Serial.print(128, BYTE); //positions cursor at line 1.
Serial.print("Adam");
//Prints:
//Adam
//(Adam)
}
#Learning3.pde
void setup() {
beginSerial(9600);
}
void loop() {
clearLCD();
Serial.print(" Hello"); // print text to the current cursor position
newLine(); // start a new line
Serial.print("Arduino");
delay(5000);
}
// clear the LCD
void clearLCD(){
Serial.print(12, BYTE);
Serial.print(0xFE, BYTE);
Serial.print(128, BYTE);
}
// start a new line
void newLine() {
Serial.print(10, BYTE);
Serial.print(0xFE, BYTE);
Serial.print(192, BYTE);
}
# Learning4.py
# Adam Crymble, Apr 27, 2009.
# This Code Does Not Work!!!!!!!!!!!!!!!!!!!!!!!!
import serial, sys
SERIALPORT = "COM5"
def printing():
ser = serial.Serial(SERIALPORT, 9600)
ser.write("abc")
print ("should print abc by now")
time.sleep(5)
ser.write("def")
print ("should print def by now")
ser.close() #close serial port
printing()

