HARDWARE
I decided to write some HOW-TOs on this particular model this weekend since I am responsible for Burcum’s purchase. First of all, please read through the Datasheet (revision 4). That is the number one thing you do every time when you encounter new technology. In the revision 4, G4 added in a new picture of how to wire µOLED-128-G1 to a micro controller, which is extremely important because the wiring is slightly different from the older models, 10k resistor is no longer required. You can wire all the pins (1,3,5,7,9) directly to your Arduino board (5v, RX, TX, GND, Pin 5). I connect the reset pin to pin 5 on my Arduino board, this will work with the code/library later. I also put together a small break-out board so I can take it with me anywhere, so nerd, yes I know.
SOFTWARE
The Arduino driver I found online is outdated, it was made for Arduino 011 when printByte was still working. I rewrote them into a library for Arduino 017 or later based on the old code by Oscar Gonzalez, download it here. Unzip, drag the entire folder and put it in the libraries folder inside of your Arduino app. The library should have everything you need to make a pong game, a portable interactive narrative thingy, omg a D&D text adventure!! In the following sample code shows how it works: Simply create an uoled instance with the reset pin number as the parameter, and you can access all the drawing functions in the library.
DISPLAY IMAGES
Now displaying images using microSD, uOLED-128-G1 has an upgraded micro SD/SDHC reader. Here are the requirements: On-board uSD/uSDHC memory card adaptor for storing of icons, images, animations, etc. Supports 64Mb to 2Gig micro-SD as well as micro-SDHC memory cards (4GB and above).
However, just by dropping images into the SD card didn’t work out for me because to display an image, uOLED requires sector address to retrieve the image from the SD card. Sector address, briefly speaking, is the minimum memory unit in SD card. In order to get those addresses, we need to organize our images though G4’s Graphics Composer Software, the bad news is it only works on Windows.
For the format of your SD card, I would try to format the cards in the Windows command prompt which can do an unconditional format and specify the filesystem. Figure out the drive letter of the card, let’s say it’s F:\, run the command prompt, and type:
format f: /u /fs:fat32
Plug the SD card in, get your pictures together and open Graphics Composer on a PC. Start a new project, save it in a new folder since there are going to be multiple files generated at the end. Right click on the left column to add new media. Once done adding, save and right click Device on the menu bar and choose Load Options, check “Serial Command Platform” and find your micro SD adaptor. Now click Device/Load. When finish loading, look at the folder you save the project, there should be a txt file. Open it up, look at the Data line of each picture, and write down the last three HEX numbers, those are the sector address of each picture. Eject the micro SD and insert it to your uoLED. You are all set to load pictures now! Enter the code and replace the last 3 HEX with the ones of your picture.
library v01 reference:
uoled(int resetpin);
void OLED_Init();
int GetRGB(int red, int green, int blue);
void OLED_Clear(); //clear the screen
void OLED_DrawLine(char x1, char y1, char x2, char y2, int color);
void OLED_DrawRectangle(char x, char y, char width, char height, char filled, int color); //filled=1, not filled =0
void OLED_DrawCircle(char x, char y, char radius, char filled, int color);
void OLED_DrawText(char column, char row, char font_size, char *mytext, int color); // font size (0 = 5×7 font, 1 = 8×8 font, 2 = 8×12 font)
**Note: Columns and rows are determined by the font size, the bigger the font size, the less columns and rows available on the 128X128 screen.