OLED 16x2 display issues

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Gardiendelanuit
 
Posts: 5
Joined: Mon Aug 11, 2014 5:05 am

OLED 16x2 display issues

Post by Gardiendelanuit »

Hi everyone,
I recently got this display: https://www.adafruit.com/products/823 and have wired without any problem.
In fact I don't know if the problem is the on the display or in the code library but setCursor() seems to do nothing and when I print something it's correctly displayed except the text begin at position 1 and goes out of the screen (right) when there is line overflow in spite having defined lcd.begin(16, 2) as in the example.
I specify the example code doesn't work for me as well.

I'm using a DUE board with D40 to D46 pin.

The code block:

Code: Select all

Adafruit_CharacterOLED lcd(OLED_V2, 40, 41, 42, 43, 44, 45, 46);

void setup() 
{
  lcd.begin(16, 2);
  lcd.print("hello OLED World"); //display   " hello OLED worl"
  lcd.setCursor(0, 1);
  lcd.print("test"); // seems to be print out of the screen on line 0 (on the right);

}
Any idea?

Thanks in advance!

User avatar
adafruit_support_bill
 
Posts: 88142
Joined: Sat Feb 07, 2009 10:11 am

Re: OLED 16x2 display issues

Post by adafruit_support_bill »

the text begin at position 1 and goes out of the screen (right) when there is line overflow in spite having defined lcd.begin(16, 2)
Lines do not automatically 'wrap' on these displays. There is an internal buffer that is 40 characters wide and the text will continue to fill that after the 16th character.

User avatar
Gardiendelanuit
 
Posts: 5
Joined: Mon Aug 11, 2014 5:05 am

Re: OLED 16x2 display issues

Post by Gardiendelanuit »

Thanks for your reply!
Ok, that clearer but why the setCursor() doesn't work? I haven't any solution to write on the second line :/
Thanks.

User avatar
adafruit_support_bill
 
Posts: 88142
Joined: Sat Feb 07, 2009 10:11 am

Re: OLED 16x2 display issues

Post by adafruit_support_bill »

Not sure what the problem is there. There have been a few unannounced manufacturer changes to the controller chip in the past. But those usually affected just the initialization code. Is this a display you purchased from us?

User avatar
Gardiendelanuit
 
Posts: 5
Joined: Mon Aug 11, 2014 5:05 am

Re: OLED 16x2 display issues

Post by Gardiendelanuit »

Yes, 2 days ago.

User avatar
adafruit_support_bill
 
Posts: 88142
Joined: Sat Feb 07, 2009 10:11 am

Re: OLED 16x2 display issues

Post by adafruit_support_bill »

If you contact [email protected] with a link to this thread, we can send a replacement.

User avatar
Gardiendelanuit
 
Posts: 5
Joined: Mon Aug 11, 2014 5:05 am

Re: OLED 16x2 display issues

Post by Gardiendelanuit »

Ok but if the problem comes from a possible new model with some different instructions code, it will be the same thing no?
Anyway the code number seems to be the same as in the product pictures.

Thanks again.

User avatar
adafruit_support_bill
 
Posts: 88142
Joined: Sat Feb 07, 2009 10:11 am

Re: OLED 16x2 display issues

Post by adafruit_support_bill »

If the problem persists, we will have to re-visit the driver. If this does not work for you, we will be happy to issue a refund.

Unfortunately in the past, manufacturing changes on these displays have not been documented and the part markings have not been changed. It is not possible to tell which version of the part you have by looking at the numbers. :(
http://forums.adafruit.com/viewtopic.ph ... 12#p218812

User avatar
Gardiendelanuit
 
Posts: 5
Joined: Mon Aug 11, 2014 5:05 am

Re: OLED 16x2 display issues

Post by Gardiendelanuit »

Thank you for the link! Indeed, it seems the call of begin() function garbage the whole thing.
I noticed this function is already called in the init() of the class, so one is sufficient..

Thanks.

User avatar
scottr
 
Posts: 2
Joined: Wed Sep 05, 2012 12:03 am

Re: OLED 16x2 display issues

Post by scottr »

I have been having the same problem.

I tried a modified sketch from the Newhaven Displays website and got the 2x16 OLED to run on the due.

Here is what worked for me:

Code: Select all

/*
 Demonstrates the use a 2x16 OLED display.
 The LiquidCrystal library works with all LCD displays that are compatible with the Hitachi HD44780 driver. 
 
 This sketch prints to the OLED and shows the time since last reset
 
  The circuit:
 * OLED RS pin to digital pin 12
 * OLED Enable pin to digital pin 11
 * OLED D4 pin to digital pin 5
 * OLED D5 pin to digital pin 4
 * OLED D6 pin to digital pin 3
 * OLED D7 pin to digital pin 2
 * OLED R/W pin to ground

 */

// include the library code:
#include <LiquidCrystal.h>
#include <Wire.h>  

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd( 8, 6, 9, 10, 11, 12); // RS=8, E=6, D4=9, D5=10, D6=11, D7=12, 6 data wires R/W tied to ground

void setup() 
{
  // Print a message to the LCD.
  lcd.begin(16, 2);
  lcd.home();
  lcd.print("hello OLED World");
  delay(5000);
  lcd.noDisplay();
  delay(2000);
  lcd.display();
}

void loop() 
{
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);
}
Hope it works for you!
Last edited by adafruit_support_bill on Sat Oct 25, 2014 6:34 am, edited 1 time in total.
Reason: please use the </> button when submitting code. press </>, then paste your code between the [code] [/code] tags.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”