Go Down

Topic: Why am I getting strange oriental characters using print.ln() function (Read 755 times) previous topic - next topic

GUNN

Can anyone explain this?


Uploaded with ImageShack.us

Code: [Select]

#include <LiquidCrystal.h>

const int timerstart = 8;
const int timerstop = 9;
int seconds = 0;
int timerstart1 = 0;
int timerstop1 = 0;
int output = 13;
int setseconds = 10;
int on = 0;

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
 
  lcd.begin(16, 2);
  pinMode(timerstart, INPUT);
  pinMode(timerstop, INPUT);
  pinMode(output, OUTPUT);
  seconds = setseconds;
}

void loop() {
  timerstart1 = digitalRead(timerstart);
  lcd.setCursor(0, 0);
  lcd.print("Time: ");
  lcd.println(seconds);

if (timerstart1 == HIGH) {
  on = 1;
}
if (timerstop1 == HIGH) {
  on = 0;
}
if (on == 1){
 
  seconds--;
delay(1000);

}

if (seconds == -1) { 
digitalWrite(output, HIGH);
seconds = setseconds;
on = 0;
delay(1000);
digitalWrite(output, LOW);

}

}

bperrybap

Code: [Select]
lcd.println(seconds);
You don't want to send <CR> and <LF> to the display.

(They are both printable characters)
--- bill

floresta

Code: [Select]
lcd.println(seconds);
In other words ... did you notice that there is no description for an lcd.println() function ?

Don

GUNN

I see what your saying, so do I need to change what function I am using or define <CR> and <LF> so that they do not appear on the screen. I am new to Arduino so could someone give an example code for what I need to do please?

Kind Regards

brunialti


floresta

Quote
I see what your saying, so do I need to change what function I am using ...

Yes. As GUNN has explained already.

Quote
... or define <CR> and <LF> so that they do not appear on the screen.

There's no way to do that.  The definitions are engraved in the computer equivalent of stone, in Read only Memory.

You have to understand that these character LCDs are not designed to replace CRT displays.  They are designed to display short messages on printers, toasters, etc.  To put stuff on a new line you have to use the 'set cursor' function.


Don

liudr

You have to control display cursor yourself if you want a new line with lcd.setCursor(x,y)
If you are already on the bottom line and do another new line, write the bottom line on the top line, and new line on the bottom line to make the message scroll.
You need to have a buffer as large as the size of the display and use it to do the new lines and scroll.

You need more effort to do what you want: scrolling and new line. On the other hand, I sell a serial LCD that will do this for you plus a bunch of other stuff. Here is the link.

GUNN

Thankyou guys!

I guess I totally misunderstood the LCD.Println() function completely!  :*

Liudr, did you get my message about using the rotary shaft encoder (phi_interface) to control variables ( i cant seem to do it) and to change the pin designation for channel A and B (changing the numbers in the define part of the code doesnt seem to work)

Kind Regards

liudr


Thankyou guys!

I guess I totally misunderstood the LCD.Println() function completely!  :*

Liudr, did you get my message about using the rotary shaft encoder (phi_interface) to control variables ( i cant seem to do it) and to change the pin designation for channel A and B (changing the numbers in the define part of the code doesnt seem to work)

Kind Regards


Yes, I did. Must have read it and somehow forgot  to reply :smiley-roll-sweat:

You can use this rotary encoder for the purpose. Why not starting a new thread so it's easy to post and read code. Just PM me the thread.

Go Up