SSD1306 Only one line of text at a time?

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

SSD1306 Only one line of text at a time?

Postby JonathanGlass » Wed Feb 29, 2012 4:51 pm

With the SSD1306, is there a clean way of putting more than one line of text on the screen at a time?
I used two oled.drawstring functions and I offset the starting point of the second one to be under the first. When I ran it, it only displayed the first and it ignored the second.
With that being said, my end game is this:
What I am trying to do is to scroll through a list of mp3s from an SD card, selecting one, and then executing the mp3 from the SD card.
If someone has already written this, lemme know.

I can list the files on the serial display but I can only get one line of text on the SSD1306 at a time.
Can you guys point me in the right direction?
JonathanGlass
 
Posts: 5
Joined: Wed Feb 29, 2012 4:27 pm

Re: SSD1306 Only one line of text at a time?

Postby JonathanGlass » Mon Mar 05, 2012 10:41 am

Nothing?
JonathanGlass
 
Posts: 5
Joined: Wed Feb 29, 2012 4:27 pm

Re: SSD1306 Only one line of text at a time?

Postby adafruit_support_bill » Mon Mar 05, 2012 11:25 am

Looking at the library code, I don't see anything that would preclude a second line of text. Can you post the code you are using?
User avatar
adafruit_support_bill
 
Posts: 15898
Joined: Sat Feb 07, 2009 9:11 am

Re: SSD1306 Only one line of text at a time?

Postby deejayspinz » Mon Mar 05, 2012 2:26 pm

I just did this the other night.. Using the 128x32 OLED LCD. Sample is below. In a nutshell, I have 3 lines of items being displayed with 2 items per line. The 2nd parameter in .drawstring is set to line 0, then I jump to 2 and 3. I figure it could do 4 lines of text but it would look tight. Sample image in my blog here. See the second image for how the below code renders.

Code: Select all
      oled.clear();

      //Distance to next red light
      oled.drawstring(0, 0, "Dist:");
      if (minDist == 100000)
      {
        oled.drawstring(30, 0, "?");
      }
        else
      {
        ftoa(cVal, minDist/1000, 2);
        oled.drawstring(30, 0, cVal);
      }
      oled.drawstring(55, 0, "km");


      //Cardinal Direction of vehicle
      //strcpy ( cVal, TinyGPS::cardinal(gps.f_course()) );
      strcpy ( cVal, gps.f_course() == TinyGPS::GPS_INVALID_F_ANGLE ? "?" : TinyGPS::cardinal(gps.f_course()));
      oled.drawstring(75, 0, "Dir:");
      oled.drawstring(100, 0, cVal);
     
      oled.drawline(0, 12, 128, 12, WHITE);

      //speed
      spd = gps.f_speed_kmph();
      if (spd < 0) {spd=0;}
      ftoa(cVal, spd, 0);
      oled.drawstring(0, 2, "Spd:");
      oled.drawstring(25, 2, cVal);


     
      //satellites
      itoa(gps.satellites(), cVal, 0);
      oled.drawstring(65, 2, "Sats:");
      oled.drawstring(90, 2, cVal);

     

      //latitude     
      ftoa(cVal, flat, 2);
      oled.drawstring(0, 3, "Lat:");
      oled.drawstring(25, 3, cVal);
      //longitude
      ftoa(cVal, flon, 2);
      oled.drawstring(65, 3, "Lng:");
      oled.drawstring(90, 3, cVal);


      //Display all the results
      oled.display();
deejayspinz
 
Posts: 39
Joined: Fri Mar 25, 2011 6:12 pm
Location: Ontario

Re: SSD1306 Only one line of text at a time?

Postby JonathanGlass » Mon Mar 05, 2012 3:41 pm

Sweet! So basically I was using :
Code: Select all
oled.drawstring(0,0,"line one text");
oled.drawstring(0,8,"line two text");
delay(1000);
oled.clear();

So if I read this correctly I need a oled.display(); at the end to put it all together.
Something like this?
Code: Select all
oled.drawstring(0,0,"line one text");
oled.drawstring(0,8,"line two text");
oled.display();
delay(1000);
oled.clear();


I will this tonight. Thanks for the help.
JonathanGlass
 
Posts: 5
Joined: Wed Feb 29, 2012 4:27 pm

Re: SSD1306 Only one line of text at a time?

Postby JonathanGlass » Mon Mar 05, 2012 3:56 pm

Anyone have anywhere I can look for a head start on displaying the files and directory structure of the the sd card on the oled screen?
I am using an Teensy++ and SD Card Adaptor from PJRC and the SSD1306 I bought here. All of the pieces have been wiring correctly and work serparately using their various example sketches. I would like to scroll through the files on the SD card and select one file for execution.
I am pretty new to the scene. I have a vb.net programming background and it is taking me a minute to get up to speed on C but I am getting there.
I appreciate any help you guys can offer.
JonathanGlass
 
Posts: 5
Joined: Wed Feb 29, 2012 4:27 pm

Re: SSD1306 Only one line of text at a time?

Postby deejayspinz » Mon Mar 05, 2012 7:34 pm

Re your prev. post. I don't think you mentioned which oled you have, but using line # 8 may be off the screen. If it doesn't work try 1 or 2 first.
deejayspinz
 
Posts: 39
Joined: Fri Mar 25, 2011 6:12 pm
Location: Ontario

Re: SSD1306 Only one line of text at a time?

Postby JonathanGlass » Mon Mar 05, 2012 8:19 pm

that is a LINE number...
I thought it was going off of pixels.
That speeds things up. :D
I got the screen working. Thanks to everyone for walking me through this.
JonathanGlass
 
Posts: 5
Joined: Wed Feb 29, 2012 4:27 pm


Return to Glowy things (LCD, LED, TFT, EL) purchased at Adafruit

Who is online

Users browsing this forum: mibignistinly and 3 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [105]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[108]
 
Wireless[14]
Cables[60]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[69]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]