Hello all,
I've got a little problem with my LCD and can't figure out what is happening.
this is what's happening:
every time I upload a sketch the screen stays as it should one piece,
But after say 3 to 10 seconds, it crashes to the first halve of the screen.
Sometimes it just crashes right away.
Now I found out I had the weird split up kind. Like here:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1276361433
I have build it like this, except I put the contrast pin to pin 6 on the arduino, so I could spare me one more pot:
But with a arduino/atmega (atmega328) chip on a breadboard.
And I use the library someone suggests on that page (liquidcrystal440).
Further more I have switched out the atmega chips, meening I looked if it was the chip malfunctioning or not.
but it's not the chip
I know of this Ram issue that can happen, where you do something in the code that writes the Ram full.
I must say I'm not a rooky, but I'm not very experienced either, but if something might be wrong with the code, I can't find it:
int pota;
int potb;
int potc;
int dval;
int buttonstate;
int apin = A0;
int bpin = A1;
int cpin = A2;
int buttonpin = 8;
int ledpin = 13;
//include a library that works with my lcd.
#include <LiquidCrystal440.h>
//set pins to use for lcd screen connections
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup(){
//set pinmodes.
pinMode(apin, INPUT);
pinMode(bpin, INPUT);
pinMode(cpin, INPUT);
pinMode(6, OUTPUT);
pinMode(buttonpin, INPUT);
pinMode(ledpin, OUTPUT);
//set screen brightness.
analogWrite(6, 70);
lcd.begin(8,2);
//start serial to debug.
Serial.begin(9600);
delay(1000);
}
void loop(){
dval = (100);
//read the value's from the potmeters
pota = (analogRead(apin));
potb = (analogRead(bpin));
potc = (analogRead(cpin));
//read the button state.
buttonstate = digitalRead(buttonpin);
//see over serial what the button state is.
Serial.println(buttonstate);
//test to see if the buton works.
if(buttonstate == 1){
digitalWrite(ledpin, HIGH);
//clear lcd just in case.
lcd.clear();
//set cursor at the start, just in case.
lcd.setCursor(0,0);
//little wait delay.
delay(10);
//print on the first halve the data we get from pin A0.
lcd.print("bA0:");
lcd.print(pota);
delay(10);
//print on the second halve the data we get from pin A1.
lcd.setCursor(0,1);
lcd.print("bA1:");
lcd.print(potb);
delay(dval);
}
else{
digitalWrite(ledpin, LOW);
delay(100);
}
}
Any suggestions would be appreciated