SSD1306 128x64 and Adafruit Trinket Pro 5V 16mhz

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: SSD1306 128x64 and Adafruit Trinket Pro 5V 16mhz

Post by adafruit_support_rick »

You must have some problem with the library. There's no other explanation. Is it possible you have two copies of the library?

You're running the ssd1306_128x64_i2c sketch?

Can you post pictures of both sides of the display?

User avatar
confused_magikarp
 
Posts: 47
Joined: Sat Dec 20, 2014 3:43 am

Re: SSD1306 128x64 and Adafruit Trinket Pro 5V 16mhz

Post by confused_magikarp »

Sorry, I deleted my previous post with a typo and it deleted yours before I had a chance to read it. Mind repeating it?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: SSD1306 128x64 and Adafruit Trinket Pro 5V 16mhz

Post by adafruit_support_rick »

You must have some problem with the library. There's no other explanation. Is it possible you have two copies of the library?

You're running the ssd1306_128x64_i2c sketch?

Can you post pictures of both sides of the display?

Can you post the exact output from the sketch?

User avatar
confused_magikarp
 
Posts: 47
Joined: Sat Dec 20, 2014 3:43 am

Re: SSD1306 128x64 and Adafruit Trinket Pro 5V 16mhz

Post by confused_magikarp »

IMG_0128.JPG
IMG_0128.JPG (603.27 KiB) Viewed 1098 times
IMG_0127.JPG
IMG_0127.JPG (397.23 KiB) Viewed 1098 times

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: SSD1306 128x64 and Adafruit Trinket Pro 5V 16mhz

Post by adafruit_support_rick »

Thanks -

You're running the ssd1306_128x64_i2c sketch?

Can you post the exact output from the sketch?

User avatar
confused_magikarp
 
Posts: 47
Joined: Sat Dec 20, 2014 3:43 am

Re: SSD1306 128x64 and Adafruit Trinket Pro 5V 16mhz

Post by confused_magikarp »

Yes, I am running that sketch.

The output is:

Code: Select all

Arduino: 1.0.5 (Mac OS X), Board: "Arduino Uno"
/Users/aidanchandra/Documents/Arduino/Adafruit Arduino 1.0.5.app/Contents/Resources/Java/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -I/Users/aidanchandra/Documents/Arduino/Adafruit Arduino 1.0.5.app/Contents/Resources/Java/hardware/arduino/cores/arduino -I/Users/aidanchandra/Documents/Arduino/Adafruit Arduino 1.0.5.app/Contents/Resources/Java/hardware/arduino/variants/standard -I/Users/aidanchandra/Documents/Arduino/Adafruit Arduino 1.0.5.app/Contents/Resources/Java/libraries/SPI -I/Users/aidanchandra/Documents/Arduino/Adafruit Arduino 1.0.5.app/Contents/Resources/Java/libraries/Wire -I/Users/aidanchandra/Documents/Arduino/Adafruit Arduino 1.0.5.app/Contents/Resources/Java/libraries/Adafruit_GFX -I/Users/aidanchandra/Documents/Arduino/Adafruit Arduino 1.0.5.app/Contents/Resources/Java/libraries/Adafruit_SSD1306 /var/folders/q9/8x5sh9lj2rldwdz3spblwlmm0000gn/T/build6066332358341986784.tmp/ssd1306_128x64_i2c.cpp -o /var/folders/q9/8x5sh9lj2rldwdz3spblwlmm0000gn/T/build6066332358341986784.tmp/ssd1306_128x64_i2c.cpp.o 
ssd1306_128x64_i2c:54: error: #error ("Height incorrect, please fix Adafruit_SSD1306.h!");
ssd1306_128x64_i2c.ino:35: warning: only initialized variables can be placed into program memory area 

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: SSD1306 128x64 and Adafruit Trinket Pro 5V 16mhz

Post by adafruit_support_rick »

Code: Select all

ssd1306_128x64_i2c:54: error: #error ("Height incorrect, please fix Adafruit_SSD1306.h!");
Yeah, see? You're not modifying the library correctly to set the height. Either that, you you've got two copies of the library and you're modifying the wrong one.

Check that your library is ONLY installed in your sketchbook/libraries folder, and that there's not another one in the Arduino/libraries folder.

You want to modify the Adafruit_SSD1306.h file to uncomment the SSD1306_128_64 symbol:

Code: Select all

   #define SSD1306_128_64
//   #define SSD1306_128_32
//   #define SSD1306_96_16

User avatar
confused_magikarp
 
Posts: 47
Joined: Sat Dec 20, 2014 3:43 am

Re: SSD1306 128x64 and Adafruit Trinket Pro 5V 16mhz

Post by confused_magikarp »

That is EXACTLY what I have. I again will post ALL of the code as a last hail mary.

Code: Select all

/*********************************************************************
This is a library for our Monochrome OLEDs based on SSD1306 drivers

  Pick one up today in the adafruit shop!
  ------> http://www.adafruit.com/category/63_98

These displays use SPI to communicate, 4 or 5 pins are required to  
interface

Adafruit invests time and resources providing this open source code, 
please support Adafruit and open-source hardware by purchasing 
products from Adafruit!

Written by Limor Fried/Ladyada  for Adafruit Industries.  
BSD license, check license.txt for more information
All text above, and the splash screen must be included in any redistribution
*********************************************************************/

#if ARDUINO >= 100
 #include "Arduino.h"
 #define WIRE_WRITE Wire.write
#else
 #include "WProgram.h"
  #define WIRE_WRITE Wire.send
#endif

#ifdef __SAM3X8E__
 typedef volatile RwReg PortReg;
 typedef uint32_t PortMask;
#else
  typedef volatile uint8_t PortReg;
  typedef uint8_t PortMask;
#endif

#include <SPI.h>
#include <Adafruit_GFX.h>

#define BLACK 0
#define WHITE 1
#define INVERSE 2

#define SSD1306_I2C_ADDRESS   0x3C	// 011110+SA0+RW - 0x3C or 0x3D
// Address for 128x32 is 0x3C
// Address for 128x64 is 0x3D (default) or 0x3C (if SA0 is grounded)

/*=========================================================================
    SSD1306 Displays
    -----------------------------------------------------------------------
    The driver is used in multiple displays (128x64, 128x32, etc.).
    Select the appropriate display below to create an appropriately
    sized framebuffer, etc.

    SSD1306_128_64  128x64 pixel display

    SSD1306_128_32  128x32 pixel display

    SSD1306_96_16

        -----------------------------------------------------------------------*/
   #define SSD1306_128_64
//   #define SSD1306_128_32
//   #define SSD1306_96_16
/*=========================================================================*/

#if defined SSD1306_128_64 && defined SSD1306_128_32
  #error "Only one SSD1306 display can be specified at once in SSD1306.h"
#endif
#if !defined SSD1306_128_64 && !defined SSD1306_128_32 && !defined SSD1306_96_16
  #error "At least one SSD1306 display must be specified in SSD1306.h"
#endif

#if defined SSD1306_128_64
  #define SSD1306_LCDWIDTH                  128
  #define SSD1306_LCDHEIGHT                 64
#endif
#if defined SSD1306_128_32
  #define SSD1306_LCDWIDTH                  128
  #define SSD1306_LCDHEIGHT                 32
#endif
#if defined SSD1306_96_16
  #define SSD1306_LCDWIDTH                  96
  #define SSD1306_LCDHEIGHT                 16
#endif

#define SSD1306_SETCONTRAST 0x81
#define SSD1306_DISPLAYALLON_RESUME 0xA4
#define SSD1306_DISPLAYALLON 0xA5
#define SSD1306_NORMALDISPLAY 0xA6
#define SSD1306_INVERTDISPLAY 0xA7
#define SSD1306_DISPLAYOFF 0xAE
#define SSD1306_DISPLAYON 0xAF

#define SSD1306_SETDISPLAYOFFSET 0xD3
#define SSD1306_SETCOMPINS 0xDA

#define SSD1306_SETVCOMDETECT 0xDB

#define SSD1306_SETDISPLAYCLOCKDIV 0xD5
#define SSD1306_SETPRECHARGE 0xD9

#define SSD1306_SETMULTIPLEX 0xA8

#define SSD1306_SETLOWCOLUMN 0x00
#define SSD1306_SETHIGHCOLUMN 0x10

#define SSD1306_SETSTARTLINE 0x40

#define SSD1306_MEMORYMODE 0x20
#define SSD1306_COLUMNADDR 0x21
#define SSD1306_PAGEADDR   0x22

#define SSD1306_COMSCANINC 0xC0
#define SSD1306_COMSCANDEC 0xC8

#define SSD1306_SEGREMAP 0xA0

#define SSD1306_CHARGEPUMP 0x8D

#define SSD1306_EXTERNALVCC 0x1
#define SSD1306_SWITCHCAPVCC 0x2

// Scrolling #defines
#define SSD1306_ACTIVATE_SCROLL 0x2F
#define SSD1306_DEACTIVATE_SCROLL 0x2E
#define SSD1306_SET_VERTICAL_SCROLL_AREA 0xA3
#define SSD1306_RIGHT_HORIZONTAL_SCROLL 0x26
#define SSD1306_LEFT_HORIZONTAL_SCROLL 0x27
#define SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL 0x29
#define SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL 0x2A

class Adafruit_SSD1306 : public Adafruit_GFX {
 public:
  Adafruit_SSD1306(int8_t SID, int8_t SCLK, int8_t DC, int8_t RST, int8_t CS);
  Adafruit_SSD1306(int8_t DC, int8_t RST, int8_t CS);
  Adafruit_SSD1306(int8_t RST);

  void begin(uint8_t switchvcc = SSD1306_SWITCHCAPVCC, uint8_t i2caddr = SSD1306_I2C_ADDRESS, bool reset=true);
  void ssd1306_command(uint8_t c);
  void ssd1306_data(uint8_t c);

  void clearDisplay(void);
  void invertDisplay(uint8_t i);
  void display();

  void startscrollright(uint8_t start, uint8_t stop);
  void startscrollleft(uint8_t start, uint8_t stop);

  void startscrolldiagright(uint8_t start, uint8_t stop);
  void startscrolldiagleft(uint8_t start, uint8_t stop);
  void stopscroll(void);

  void dim(boolean dim);

  void drawPixel(int16_t x, int16_t y, uint16_t color);

  virtual void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
  virtual void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);

 private:
  int8_t _i2caddr, _vccstate, sid, sclk, dc, rst, cs;
  void fastSPIwrite(uint8_t c);

  boolean hwSPI;
  PortReg *mosiport, *clkport, *csport, *dcport;
  PortMask mosipinmask, clkpinmask, cspinmask, dcpinmask;

  inline void drawFastVLineInternal(int16_t x, int16_t y, int16_t h, uint16_t color) __attribute__((always_inline));
  inline void drawFastHLineInternal(int16_t x, int16_t y, int16_t w, uint16_t color) __attribute__((always_inline));

};

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: SSD1306 128x64 and Adafruit Trinket Pro 5V 16mhz

Post by adafruit_support_rick »

You *must* have a library installation issue. The IDE is *not* finding the library you've edited - it's finding some other copy of the library.

Where is your SSD1306 library installed? Did you put it in the sketchbook libraries folder, or in the Arduino libraries folder?

Check for another copy of the library in the Arduino libraries folder.

In the IDE preferences, what is the path to the sketchbook folder? Is the libraries folder with your SSD1306 library in that path?

Do you have a copy of the SSD1306 library under a different name in your libraries folder?

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

Return to “Arduino”