ciao a tutti.
oggi mi è successa una cosa che non mi so spiegare:
installo un mio sketch, fondamentalmente un voltmetro che visualizza la tensione sull'LCD in oggetto.
tutto funziona a meraviglia come ha sempre fatto negli ultimi giorni.
dopo uno dei tanto upload dello stesso sketch rielaborato (non nella parte LCD!) ho iniziato ad avere problemi.
ho allora scritto un mini sketch per provare l'LCD (allegato sotto):
- all'accensione tutto ok, visualizza la solita schermata : "SPARKFUN.com Ser LCD v2.5
poi il mistero... - per una frazione di secondo scrive sulla prima riga "09" e sulla seconda "-".
vorrei far scrivere un testo "abcdef". Funziona SOLO se lo faccio dalla colonna 2 sia per la riga 1 che per la riga 0.
se tento di scrivere su 0,0 l'LCD scrive con un'ordine improponibile tipo:
"ec "
"fd "
se tento di scrivere su 1,0 l'LCD scrive con un'ordine improponibile tipo:
"df "
"ec "
se tento di scrivere su 0,1 l'LCD scrive con un'ordine improponibile tipo:
"ce "
"df "
se tento di scrivere su 1,1 l'LCD scrive con un'ordine improponibile tipo:
"fd "
"ce "
CHE DIAVOLO E' SUCCESSO???? ho fatto qualche modifica sul codice o mi è partito l'LCD?
grazie a tutti!
#include <SoftwareSerial.h>
#define txPin 2
SoftwareSerial LCD = SoftwareSerial(0, txPin);
// since the LCD does not send data back to the Arduino, we should only define the txPin
const int LCDdelay=500; // conservative, 2 actually works
// wbp: goto with row & column
void lcdPosition(int row, int col) {
LCD.write(0xFE); //command flag
LCD.write((col + row*64 + 128)); //position
delay(LCDdelay);
}
void clearLCD(){
LCD.write(0xFE); //command flag
LCD.write(0x01); //clear command.
delay(LCDdelay);
}
void backlightOn() { //turns on the backlight
LCD.write(0x7C); //command flag for backlight stuff
LCD.write(157); //light level.
delay(LCDdelay);
}
void backlightOff(){ //turns off the backlight
LCD.write(0x7C); //command flag for backlight stuff
LCD.write(128); //light level for off.
delay(LCDdelay);
}
void serCommand(){ //a general function to call the command flag for issuing all other commands
LCD.write(0xFE);
}
void setup()
{
LCD.begin(9600);
clearLCD();
backlightOn();
pinMode(txPin, OUTPUT);
}
void loop ()
{
lcdPosition(0,0);
clearLCD();
pinMode(txPin, OUTPUT);
lcdPosition(1,1); //riga, colonna
LCD.print("abcdef");
}