Hi everyong
there is a problem with my LCD
i am using the DRrobot LCD shield
there is showing something on the LCD.
it is like "=="
my LCD is broke or something ?
or the program problem makes it happen ?
Thanks a lot
What program would that be?
Here it is, thanks.
#define FREQ_PIN 3
#include <LiquidCrystal.h>
#include <Fat16.h>
#include <Fat16util.h>
SdCard card;
Fat16 file;
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
void writeNumber(uint32_t n)
{
uint8_t buf[10];
uint8_t i = 0;
do {
i++;
buf[sizeof(buf) - i] = n%10 + '0';
n /= 10;
} while (n);
file.write(&buf[sizeof(buf) - i], i); // write the part of buf with the number
}
void setup(void) {
pinMode(FREQ_PIN, INPUT);
lcd.begin(16, 2);
char name[] = "WRITE00.TXT";
for (uint8_t i = 0; i < 100; i++) {
name[5] = i/10 + '0';
name[6] = i%10 + '0';
// O_CREAT - create the file if it does not exist
// O_EXCL - fail if the file exists
// O_WRITE - open for write
if (file.open(name, O_CREAT | O_EXCL | O_WRITE)) break;
}
PgmPrint("Now Speed: ");
// write 100 line to file
for (uint8_t i = 0; i < 100; i++) {
file.write("line "); // write string from RAM
writeNumber(i);
file.write_P(PSTR(" millis = ")); // write string from flash
writeNumber(millis());
}
// close file and force write of all data to the SD card
file.close();
PgmPrintln("Done");
}
void loop(void)
{
unsigned long t1 = pulseIn(FREQ_PIN, HIGH);// Time how long it takes to go HIGH again
unsigned long t2 = pulseIn(FREQ_PIN, LOW); // and how long it takes to go low again.
double t = t1 + t2;
double f = 1/t;
double w = 2 * 3.14 * f;
double v = w * 0.05;
lcd.setCursor(0,0);
lcd.println(v);
delay(2000);
file.write(v); // file.println() would work also
}
The LCD show me like this
Is my LCD broke ?
// maybe try this in your loop
lcd.clear();
lcd.setCursor(0,0);
lcd.println("broken? ");
delay(1000);
lcd.setCursor(0,1);
lcd.println("lets see");
delay(1000);
lcd.clear();
lcd.setCursor(0,0);
lcd.println("that char?");
lcd.setCursor(0,1);
for(int k=0; k<=7; k++){
delay(500);
lcd.print(k, BYTE);
}
// the strange chars look like "custom chars" designed by accident
// best, ku
the strange chars look like "custom chars" designed by accident
No they don't. Each of them has a dot displayed in the 8th row, the row reserved for the cursor.
Don
you used lcd.println
the LiquidCrystal included with Arduino-18 doesn't handle the carriage return and line feed characters correctly--it tries to display them instead of repositioning the cursor.
that's the way I recall them looking. Switch to lcd.print and the strangeness should go away.