Well I've got the LCD now and I'm having issues with it...
I can't seem to consistently get it to work properly. I've done a couple things and it does some stuff, but it just doesn't seem to work properly.
Either I am communicating with it in a completely wrong manner or the baud rate is not consistent enough for it...
Datasheet for the LCD I got:
http://www.sparkfun.com/datasheets/LCD/DX160.pdfMy test code, currently set to clear the LCD screen, wait a millisecond, then output the string "text horray" because if I can get it to output some text on the screen correctly, I'll be happy.
there is also a demo program for the computer:
http://www.sparkfun.com/datasheets/LCD/dx160.zipI used that program and it works good.
I've been trying to use the TTL port.
I don't know what the program on the computer is doing that Arduino is not (also I've check the outputs from Arduino with hyperterminal, baud rate at 57600, works fine).
I was going to change the baud rate to 9600, that seems to be more standard for stuff in general, but I don't know how to software change the baud rate... don't you need to be communicating with it at a particular baud rate, send the signal, then switch to the new baud rate? I don't understand how I would do that with the demo program they give, Arduino (since it's not communicating proerly at the moment) or hyperterminal...
So yeah, for some reason the screen isn't working properly/consistently with Arduino at the moment. Please help!
(this is a simple modification of the debounce tutorial)
/* Debounce
*
* Each time the input pin goes from LOW to HIGH (e.g. because of a push-button
* press), the output pin is toggled from LOW to HIGH or HIGH to LOW. There's
* a minimum delay between toggles to debounce the circuit (i.e. to ignore
* noise).
*
* David A. Mellis
* 21 November 2006
*
*
http://www.arduino.cc/en/Tutorial/Debounce */
int inPin = 7; // the number of the input pin
int outPin = 13; // the number of the output pin
int state = HIGH; // the current state of the output pin
int reading; // the current reading from the input pin
int previous = LOW; // the previous reading from the input pin
// the follow variables are long's because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long time = 0; // the last time the output pin was toggled
long debounce = 200; // the debounce time, increase if the output flickers
void setup()
{
pinMode(inPin, INPUT);
pinMode(outPin, OUTPUT);
Serial.begin(57600);
}
void loop()
{
reading = digitalRead(inPin);
// if we just pressed the button (i.e. the input went from LOW to HIGH),
// and we've waited long enough since the last press to ignore any noise...
if (reading == HIGH && previous == LOW && millis() - time > debounce) {
// ... invert the output
Serial.print(186);
delay(1);
Serial.print("text horray");
if (state == HIGH){
state = LOW;
}
else{
state = HIGH;
}
// ... and remember when the last button press was
time = millis();
}
//if (state == LOW)
// Serial.print("text horray!");
digitalWrite(outPin, state);
previous = reading;
}