Dobrý den,
mám lcd 4×20
základ programu přímo zde:
https://playground.arduino.cc/Learning/SparkFunSerLCD
po nahrání programu se mi lcd zkrátí o 4 body na 4×16. poslední 4 body nefungují. znaky na těchto pozicích se objevují jinde. vždy na začátku toho předchozího řádku.
můj program vypadá takhle :
void loop() {
// Example usage:
clearLCD();
backlightOn();
//————————————————
selectLineOne();
delay(100);
Serial.print(„T1:“);
Serial.print(dht1.readTemperature(),1);
Serial.print((char)223); // vypíše znak ° na displej
Serial.print(„C „);
Serial.print(„T2:“);
Serial.print(dht2.readTemperature(),1);
Serial.print((char)223); // vypíše znak ° na displej
Serial.print(„C“);
delay(500);
//————————————————
selectLineTwo();
delay(100);
Serial.print(„Vl:“);
Serial.print(dht1.readHumidity(),1);
Serial.print(„% „);
Serial.print(„V2:“);
Serial.print(dht2.readHumidity(),1);
Serial.print(„%“);
delay(500);
//————————————————
selectLineThree();
delay(100);
Serial.print(„VP:“);
Serial.print(analogRead(A1));
Serial.print(“ „);
Serial.print(„S:“);
Serial.print(analogRead(temt6000Pin));
Serial.print(“ „);
delay(500);
//———————————————
selectLineFour();
delay(100);
Serial.print(„Prutok:“);
Serial.print(flowMilliLitres,1);
Serial.print(„mL“);
delay(500);
delay(5000);
}
//SerialLCD Functions
void selectLineOne(){ //puts the cursor at line 0 char 0.
Serial.write(0xFE); //command flag
Serial.write(128); //position
}
void selectLineTwo(){ //puts the cursor at line 2 char 0.
Serial.write(0xFE); //command flag
Serial.write(192); //position
}
void selectLineThree(){ //puts the cursor at line 3 char 0.
Serial.write(0xFE); //command flag
Serial.write(148); //position
}
void selectLineFour(){ //puts the cursor at line 4 char 0.
Serial.write(0xFE); //command flag
Serial.write(212); //position
}
void goTo(int position) { //position = line 1: 0-19, line 2: 20-39, etc, 79+ defaults back to 0
if (position<20){ Serial.write(0xFE); //command flag
Serial.write((position+128)); //position
}else if (position<40){Serial.write(0xFE); //command flag
Serial.write((position+128+64-20)); //position
}else if (position<60){Serial.write(0xFE); //command flag
Serial.write((position+128+20-40)); //position
}else if (position<80){Serial.write(0xFE); //command flag
Serial.write((position+128+84-60)); //position
} else { goTo(0); }
}
void clearLCD(){
Serial.write(0xFE); //command flag
Serial.write(0x01); //clear command.
}
void backlightOn(){ //turns on the backlight
Serial.write(0x7C); //command flag for backlight stuff
Serial.write(157); //light level.
}
void backlightOff(){ //turns off the backlight
Serial.write(0x7C); //command flag for backlight stuff
Serial.write(128); //light level for off.
}
void backlight50(){ //sets the backlight at 50% brightness
Serial.write(0x7C); //command flag for backlight stuff
Serial.write(143); //light level for off.
}
void serCommand(){ //a general function to call the command flag for issuing all other commands
Serial.write(0xFE);
file:///C:/Users/Tom/Desktop/IMAG0052.jpg