Go Down

Topic: 16x2 LCD prints foreign letters? (Read 2825 times) previous topic - next topic


dc42


The LCD Pins:
1 - To ground.
2 - To 5v
3 - To pot.
4 - To Arduino pin 7.
5 - To ground.
6 - To Arduino pin 8.
11 - To Arduino pin 9.
12 - To Arduino pin 10.
13 - To Arduino pin 11.
14 - To Arduino pin 12.
15 - To 5v.
16 - To ground.

The ones I skipped are not connected to anything. From that, is my wiring and LCD variable in the code all correct?


That wiring does correspond to the LCD constructor call in the code you posted.

Try a sketch that does the begin call, then sets the cursor position and prints a single character, or 4 characters all the same. Experiment with different cursor positions and characters. From the results you get, we may be able to establish where the problem lies.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Ciehanski



The LCD Pins:
1 - To ground.
2 - To 5v
3 - To pot.
4 - To Arduino pin 7.
5 - To ground.
6 - To Arduino pin 8.
11 - To Arduino pin 9.
12 - To Arduino pin 10.
13 - To Arduino pin 11.
14 - To Arduino pin 12.
15 - To 5v.
16 - To ground.

The ones I skipped are not connected to anything. From that, is my wiring and LCD variable in the code all correct?


That wiring does correspond to the LCD constructor call in the code you posted.

Try a sketch that does the begin call, then sets the cursor position and prints a single character, or 4 characters all the same. Experiment with different cursor positions and characters. From the results you get, we may be able to establish where the problem lies.


When I do the lcd.cursor(); it doesn't show it at all, but when uploading to the board it shows up, not at the beginning of the line, but about 4 spaces away from the end, and then when uploading is done, it disappears.

Also, when I do lcd.print("Test"); it doesn't even show the weird symbols anymore. My lcd variable code must not be in order.

Ciehanski

Forget that. But the cursor doesn't show. But the symbols do.

floresta

@Ciehanski
You really should not use the Quote button with orange text at the upper right of a previous reply unless you really intend to quote the full text of that particular reply.  If that is not the case then you should use the Reply button with black text that is under the last reply.

Don

floresta

Quote
Forget that. But the cursor doesn't show. But the symbols do.

The cursor is not shown by default. I think the 'lcd.cursor()' command is used to turn it on.

Don

Ciehanski


Quote
Forget that. But the cursor doesn't show. But the symbols do.

The cursor is not shown by default. I think the 'lcd.cursor()' command is used to turn it on.

Don


I rewired, and recoded my sketch to the LCD Library tutorial on the Arduino site. It still prints the weird symbols, and sometimes doesn't print or show the cursor at all.

Code:
Code: [Select]

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int sencePin = 0;
int switchPin = 8;
int ledPin = 6;
int yellowPin = 7;
boolean lastButton = LOW;
boolean currentButton = LOW;
int ledLevel;
int val;
boolean on = false;

void setup()
{
  Serial.begin(9600);
  pinMode(switchPin, INPUT);
  pinMode(ledPin, OUTPUT);
  pinMode(yellowPin, OUTPUT);
  lcd.begin(16, 2);   
  lcd.clear();
  lcd.cursor();
}

boolean debounce(boolean last)
{
  boolean current = digitalRead(switchPin);
  if (last != current)
  {
    delay(5);
    current = digitalRead(switchPin);
  }
  return current;
}

void readLight()
{
   Serial.println(analogRead(sencePin));
   delay(1000);
}

void loop()
{
  int yPin = digitalRead(yellowPin);
  int sPin = digitalRead(switchPin);
  val = analogRead(sencePin);
  val = constrain(val, 250, 800);
  ledLevel = map(val, 250, 800, 255, 0);
  currentButton = debounce(lastButton);
 
  if (currentButton == HIGH && lastButton == LOW)
  {
      on = !on;
  }
 
  if (yPin == HIGH)
  {
   lcd.print("Works!");
  }
 
  if (on == true)
  {
    lcd.display();
    lcd.clear();
    digitalWrite(ledPin, HIGH);
    analogWrite(yellowPin, ledLevel);
  } else if (on == false) {
    lcd.noDisplay();
    digitalWrite(ledPin, LOW);
    digitalWrite(yellowPin, LOW);
  }
  lastButton = currentButton;
}


I added some buttons, LEDs, and a light sensor.

liudr

How good is your soldering on the female connector? Can you take a picture of the under side of the lcd to show the soldering job?

JoeO

What happens when you run Floresta's code in reply #5?

Ciehanski


How good is your soldering on the female connector? Can you take a picture of the under side of the lcd to show the soldering job?

I'll upload one soon.


What happens when you run Floresta's code in reply #5?

It just shows the symbols.

dc42


Forget that. But the cursor doesn't show. But the symbols do.


My mistake, I meant lcd.setCursor(...) - I wanted to see whether cursor positioning worked.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Ciehanski



Forget that. But the cursor doesn't show. But the symbols do.


My mistake, I meant lcd.setCursor(...) - I wanted to see whether cursor positioning worked.


Even in the hello world tutorial, the cursor, nor the text shows. I even re-soldered the header pins. I have no idea what's wrong.

Ciehanski

Here is my solder job: http://troll.ws/i/Kd8Gei.jpg

floresta

Quote
Quote
Quote from: JoeO on December 10, 2011, 11:01:32 PM
What happens when you run Floresta's code in reply #5?

It just shows the symbols.


Come on, give us some help here....
Does it always show the same three symbols?
Are they always in the same position?
Are there symbols on both lines?


Don


Ciehanski


Quote
Quote
Quote from: JoeO on December 10, 2011, 11:01:32 PM
What happens when you run Floresta's code in reply #5?

It just shows the symbols.


Come on, give us some help here....
Does it always show the same three symbols?
Are they always in the same position?
Are there symbols on both lines?


Don




No, different symbols. Different positions depending on the words being printed. They only appear on the first line.

Go Up