sparkfun / SparkFun_SSD1320_OLED_Arduino_Library

Display graphics and text on a flexible grayscale display
10 stars 5 forks source link

Can't set color #5

Closed Vasile-Peste closed 5 years ago

Vasile-Peste commented 5 years ago

Hi, the display is awesome. Using the library I can't set a color different than WHITE or BLACK. Also I looked at your library and I found something strange. Sorry for my confusion.

// SSD1320_OLED.h
#define BLACK 0
#define WHITE 1

Black should be 0 and white 255 or am I wrong?

// SSD1320_OLED.cpp
/** \brief Set color.
    Set the current draw's color. Only WHITE and BLACK available.
*/
void SSD1320::setColor(uint8_t color) {
  foreColor = color;
}

Why I can't set a color different than white or black? In the README.md of this repository you have as an example an image loaded with different shades of black and white, why I can't use these colors? Sorry again for my confusion.

By the way, this is a video of your display in action with PONG: https://youtu.be/sQk5tUnh5TU. Waiting for a bigger one, thank you.

nseidle commented 5 years ago

Nice video! Thank you for recording it!

To clarify, the OLED is monochrome so there is no 'color' per se, just On/Off pixels. The display does support 4-bit grayscale but this library is memory limited to only support 1-bit (on/off).

The #define WHITE 1 is arbitrary and used as a check in setPixel().

Grayscale is possible but requires a larger amount of RAM (perhaps a Teensy could do it). The grayscale example uses the JPEG to 4-bit BMP script to generate a static array. This array can be sent over serial or can be stored in ProgMem but there's not enough RAM on the Uno to store a frame buffer of 4-bits for the entire display.