SSD1306 Library: Error with redeclaration of "random()" (edited) [SOLVED]

I am currently trying to use a Diymall 0.96 inch OLED display with my Particle Photon with I2C communication, but the library example for the Adafruit_GFX does not seem to be working. This is the compile error that I am receiving, and I can’t seem to understand what’s going on. I am only using one library, the SSD1306 library, and I’ve #included it correctly (to my knowledge). I’ve been looking online for a fix, but I’m not finding one immediately. Could someone help me out? A lot of the guides I have found have been for SPI (, so this is a tough one.


This actually is not a problem of pgm_read_byte which only produces a warning (would still build).
The actual error revolves around the redeclaration of int random(int).

Just remove/rename the function and it will build.

A forum search would have given you this (which also applies to I2C, since it’s basically the same sample, just different interface)
Adafruit SSD1306 [SOLVED]


Thank you ScruffR! This worked immediately. Happy Thanksgiving, as well.


Glad to hear that :+1:

I altered the topic title accordingly
Original title: “SSD1306 Library example:warning: “pgm_read_byte” redefined [enabled by default]”

1 Like