0

Writing simple text to OLED 128x64 via SPI using Trinket
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Writing simple text to OLED 128x64 via SPI using Trinket

by chunshao911 on Fri Oct 23, 2015 4:24 pm

adafruit_support_bill wrote:What processor are you using?

Arduino IDE, 1.6.4

chunshao911
 
Posts: 9
Joined: Wed Jul 01, 2015 12:41 pm

Re: Writing simple text to OLED 128x64 via SPI using Trinket

by chunshao911 on Fri Oct 23, 2015 4:25 pm

chunshao911 wrote:
adafruit_support_bill wrote:What processor are you using?

Arduino IDE, 1.6.4



Arduino uno

chunshao911
 
Posts: 9
Joined: Wed Jul 01, 2015 12:41 pm

Re: Writing simple text to OLED 128x64 via SPI using Trinket

by chunshao911 on Fri Oct 23, 2015 4:36 pm

adafruit_support_bill wrote:What processor are you using?

what kind of processor? you mean what type of arduino board? its uno, and i am using arduino 1.6.4

chunshao911
 
Posts: 9
Joined: Wed Jul 01, 2015 12:41 pm

Re: Writing simple text to OLED 128x64 via SPI using Trinket

by adafruit_support_bill on Sat Oct 24, 2015 5:34 am

This is a bit off topic, since this thread is about the Trinket. It is possible you have a memory problem. This guide has some tips on diagnosing memory issues: http://learn.adafruit.com/memories-of-an-arduino

adafruit_support_bill
 
Posts: 66744
Joined: Sat Feb 07, 2009 10:11 am

Re: Writing simple text to OLED 128x64 via SPI using Trinket

by fnb111 on Tue Apr 24, 2018 9:51 am

jboyton wrote:It's not really true that a 1K buffer is needed for a 128x64 display. For example, the u8glib library provides full graphic support with a smaller buffer. U8glib trades speed for free ram: the smaller the buffer, the slower the graphics.

If you only want text it's possible to write to this display without any buffer at all. There is a library called SSD1306ASCII that does this. I took that library and modified/improved it and have been using it for a few months. Last time I checked it uses 61 bytes of sram when configured for SPI.

I'm not sure if u8glib has support for the Trinket or what issues might arise from porting it to that platform. I have only used the text-only library on an Uno.

Both u8glib and the text-only libraries work with I2C as well as SPI and software SPI.

U8glib is published and supported. The text-only library I am using is unpublished but I will happily share the latest version. The original SSD1306ASCII is available on the internet for download.

jboyton

Ive tried the ASCii and its not working for me.

Code: Select all | TOGGLE FULL SIZE
// Simple SPI test for ebay 128x64 oled.

#include <SPI.h>
#include "SSD1306Ascii.h"
#include "SSD1306AsciiSpi.h"

// pin definitions

#define CS_PIN  A2
//#define RST_PIN   // changed this
#define DC_PIN  A3

SSD1306AsciiSpi oled;
//------------------------------------------------------------------------------
void setup() {
  // Use next line if no RST_PIN or reset is not required.
  oled.begin(&Adafruit128x64, CS_PIN, DC_PIN); 
  //oled.begin(&Adafruit128x64, CS_PIN, DC_PIN, RST_PIN);
  oled.setFont(Adafruit5x7); 

  uint32_t m = micros();
  oled.clear(); 
  oled.println("Hello world!");
  oled.println("A long line may be truncated");
  oled.println();
  oled.set2X();
  oled.println("2X demo");
  oled.set1X();
  oled.print("\nmicros: ");
  oled.print(micros() - m);
}
//------------------------------------------------------------------------------
void loop() {}


no problems compiling./ NANO ATMega328p /OLED 128x64- 4 wire
Thanks in advance

fnb111
 
Posts: 3
Joined: Sun Apr 15, 2018 9:00 pm

Please be positive and constructive with your questions and comments.