Twig - OLED 96x96

Hi There,

Did anyone succeed in printing text messages to this twig?

I am fiddling around with this Twig. When I print a single character to the display, the 4 columns (2 segments per column) are printed from top-to-down. Might have to do with the vertical mode. In the wiki page I read the following line “A modified vertical addressing method is used for displaying text in the driver provided.”. What is exactly meant by this.

Thanks,
Merijn

Hi Merijn,

I would like to understand the issue. Could you please let us know if garden.seeedstudio.com/index.php … ello_World works fine in your environment ?
“Modified vertical addressing method is used for displaying text in the driver provided.” means each 8x8 pixel character is drawn in vertical mode.

Please use

SeeedGrayOled.setVerticalMode();  // Set to vertical mode for displaying text

before drawing characters.

Let us know if this solves the issue.

Regards,
Viswa

Hi,

I indeed put the display in vertical mode. What I expect is that the character prints as follows:
xxxxxxxxx
xxxxxxxxx
xxxxxxxxx
xxxxxxxxx
xxxxxxxxx
xxxxxxxxx
xxxxxxxxx
xxxxxxxxx
(8x8)

However I get this:
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx

This is printed from top to bottom.

A little background information: I am trying porting the display code to the Microsoft .Net Micro framework.

Merijn

Hello Merijn,

The provided library and examples have been tested on Seeeduino(Arduino) and works well.

As far I understand there is some issue in initializing the proper mode for the display.
While porting please check if the same display-initialization-routine is used.
Also check if any delay needs to be included in init code.

Please post the ported code, I will see if I can help you as I have not worked with .Net Micro framework.

Regards,
Viswa

Hi,

Will try to reproduce the problem. Good news, I finally got this tiny lovely display up and running. :bulb: Still have no clue what went wrong. I guess it has to do with entering command mode, and sending commands/data to I2C. Or maybe the frequency. Now I’m doing two bytes at a time and it seems to be ok!

On the foto a picture of the twig showing the Seeed logo. Also on the picture is the Xprotolab from gabotronics.com. This small miracle I used to trace down the I2C protocol. Also on the foto some traces of Belgium beer, an old Sinclair ZX81… and of course the GHI Electronics FEZ Panda II and the FEZ Connect.

I shared ported code below. Also in the test program a small surprise picture (decent). http://www.youtube.com/watch?v=EVpX-7xwkmo and http://www.youtube.com/watch?v=aFYHLKeWFqo

Cheers,

Merijn
seeed_grayoled.JPG

/*
SeeedGrayOLED - SSD1327 Gray OLED Driver Library
2011 Copyright © Seeed Technology Inc. All right reserved.

Author: Visweswara R

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Ported to .NET Micro Framework by Merijn van Mourik
Current issues:
- at inverse mode display turns grey instead of black/white
- putnumber, unsigned int: FFFFFFFF will be 4294967295 instead of -1
- code could generate less garbages to collect for garbage collector
- characters somehow print inverse
(however this beautifully shows off the gray scale!)
*/

using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

namespace SeeedStudio.Twig
{
public class SeeedGrayOled_96x96 : IDisposable
{
//constants
const int CLOCK_FREQ = 400;
const int DELAY = 40;

    public enum AddressingMode
    {
        Vertical = 0x0,
        Horizontal = 0x1
    };

    public enum DisplayMode
    {
        Normal = 0x0,
        Inverse = 0x1
    }

    const int VERTICAL_MODE = 01;
    const int HORIZONTAL_MODE = 02;

    const byte Address = 0x3c;
    const byte Command_Mode   = 0x80;
    const byte Data_Mode = 0x40;

    const byte Display_Off_Cmd = 0xAE;
    const byte Display_On_Cmd  = 0xAF;

    const byte Normal_Display_Cmd = 0xA4;
    const byte Inverse_Display_Cmd = 0xA7;
    const byte Activate_Scroll_Cmd	= 0x2F;
    const byte Deactivate_Scroll_Cmd = 0x2E;
    const byte Set_ContrastLevel_Cmd = 0x81;

    public enum ScrollDirection
    {
        Left = 0x0,
        Right = 0x1
    };

    public enum ScrollSpeed
    {
        SpeedA_2x = 0x7,
        SpeedB_3x = 0x4,
        SpeedC_4x = 0x5,
        SpeedD_5x = 0x0,
        SpeedE_25x = 0x6,
        SpeedF_64x = 0x1,
        SpeedG_128x = 0x2,
        SpeedH_265x = 0x3
    }

    //greylevel for text, default bright
    private byte grayH = 0xF0;
    private byte grayL = 0x0F;

    public AddressingMode addressingMode = AddressingMode.Horizontal;

    private I2CDevice.Configuration config;
    private I2CDevice device;
    private I2CDevice.I2CTransaction[] transaction;

    public SeeedGrayOled_96x96()
    {
        config = new I2CDevice.Configuration(0x3c, CLOCK_FREQ);
        device = new I2CDevice(config);
        transaction = new I2CDevice.I2CTransaction[1];

        sendCommand(0xFD); // Unlock OLED driver IC MCU interface from entering command. i.e: Accept commands
        sendCommand(0x12);
        sendCommand(0xAE); // Set display off
        sendCommand(0xA8); // set multiplex ratio
        sendCommand(0x5F); // 96
        sendCommand(0xA1); // set display start line
        sendCommand(0x00);
        sendCommand(0xA2); // set display offset
        sendCommand(0x60);
        sendCommand(0xA0); // set remap
        sendCommand(0x46);
        sendCommand(0xAB); // set vdd internal
        sendCommand(0x01); //
        sendCommand(0x81); // set contrasr
        sendCommand(0x53); // 100 nit
        sendCommand(0xB1); // Set Phase Length
        sendCommand(0x51); //
        sendCommand(0xB3); // Set Display Clock Divide Ratio/Oscillator Frequency
        sendCommand(0x01);
        sendCommand(0xB9); //
        sendCommand(0xBC); // set pre_charge voltage/VCOMH
        sendCommand(0x08); // (0x08);
        sendCommand(0xBE); // set VCOMH
        sendCommand(0x07); // (0x07);
        sendCommand(0xB6); // Set second pre-charge period
        sendCommand(0x01); //
        sendCommand(0xD5); // enable second precharge and enternal vsl
        sendCommand(0x62); // (0x62);
        sendCommand(0xA4); // Set Normal Display Mode
        sendCommand(0x2E); // Deactivate Scroll
        System.Threading.Thread.Sleep(100);

        // Set Row Address
        sendCommand(0x75); // Set Row Address
        sendCommand(0x00); // Start 0
        sendCommand(0x5f); // End 95

        // Set Column Address
        sendCommand(0x15);  // Set Column Address
        sendCommand(0x08);  // from 8th (0x08)
        sendCommand(0x37);  // to 55th (8+47) each column has 2 pixels (segments)

        // Row Address
        sendCommand(0x75); 	  // Set Row Address 
        sendCommand(0x00); 	  // Start 0
        sendCommand(0x5f); 	  // End 95 

        // Init gray level for text. Default: Brightest White
        grayH = 0xF0;
        grayL = 0x0F;

        //this.setHorizontalMode();
        //this.clearDisplay();
        sendCommand(0xAF); // Switch on display
    }

    private void sendCommand (byte command)
    {
        transaction[0] = I2CDevice.CreateWriteTransaction(new byte[] { Command_Mode, command });
        device.Execute(transaction, DELAY);
    }

    private void setContrastLevel(uint ContrastLevel)
    {
        sendCommand(Set_ContrastLevel_Cmd);
        sendCommand((byte) ContrastLevel);
    }
    
    public void setHorizontalMode()
    {
        // remap to horizontal mode
        sendCommand(0xA0); 
        sendCommand(0x42); 

        // row Address
        sendCommand(0x75);  // Set Row Address 
        sendCommand(0x00); 	// Start 0
        sendCommand(0x5f); 	// End 95 

        // column Address
        sendCommand(0x15); 	// Set Column Address 
        sendCommand(0x08); 	// Start from 8th Column of driver IC. This is 0th Column for OLED 
        sendCommand(0x37); 	// End at  (8 + 47)th column. Each Column has 2 pixels(or segments)

        addressingMode = AddressingMode.Horizontal;
    }

    public void setVerticalMode()
    {
        // remap to vertical mode
        sendCommand(0xA0); 
        sendCommand(0x46);

        addressingMode = AddressingMode.Vertical;
    }

    public void setTextXY (byte Row, byte Column)
    {
        //Column Address
        sendCommand(0x15); 	                    /* Set Column Address */
        sendCommand((byte)(0x08+ (Column*4)));  /* Start Column: Start from 8 */
        sendCommand(0x37); 	                    /* End Column */

        // Row Address
        sendCommand(0x75); 	                    /* Set Row Address */
        sendCommand((byte)(0x00+(Row*8)));      /* Start Row*/
        sendCommand((byte)(0x07+(Row*8)));       /* End Row*/
    }

    public void clearDisplay()
    {
        uint i, j;
        for (j = 0; j < 48; j++)
        {
            for (i = 0; i < 96; i++) // clear all columns)
            {
                sendData(0x00);
            }
        }
    }

    private void sendData (byte data)
    {
        transaction[0] = I2CDevice.CreateWriteTransaction(new byte[] { Data_Mode, data });
        device.Execute(transaction, DELAY);
    }

    public void setGrayLevel(byte grayLevel)
    {
        grayH = (byte)((grayLevel << 4) & 0xF0);
        grayL = (byte)(grayLevel & 0x0F);
    }

    public void putChar(char C)
    {
        if (C < 32 || C > 127) //Ignore non-printable ASCII characters. This can be modified for multilingual font.
        {
            C = ' '; //Space
        }

        for (int i=0; i < 8; i=i+2)
        {
            for (int j=0; j<8; j++)
            {
                // Character is constructed two pixel at a time using vertical mode from the default 8x8 font
                byte c = 0x00;
                byte bit1 = (byte)((BasicFont[C - 32][i] >> j) & 0x01);
                byte bit2 = (byte)((BasicFont[C - 32][i + 1] >> j) & 0x01);
                c |= (byte)((bit1 == 0) ? grayH : 0x00);
                c |= (byte)((bit2 == 0) ? grayL : 0x00);
                sendData(c);
            }
        }
    }

    public void putString(string S)
    {
        foreach (char C in S.ToCharArray())
        {
            putChar(C);
        }
    }

    public uint putNumber(long long_num)
    {
        char[] char_buffer = new char[10];
        char_buffer = "          ".ToCharArray();

        uint i = 0;
        uint f = 0;

        if (long_num < 0)
        {
            f=1;
            putChar('-');
            long_num = -long_num;
        }
        else if (long_num == 0)
        {
            f=1;
            putChar('0');
            return f;
        }

        while (long_num > 0)
        {
            char_buffer[i++] = (char)(long_num % 10);
            long_num /= 10;
        }

        f=f+i;
        for(; i > 0; i--)
        {
            putChar((char) ('0'+ char_buffer[i - 1]));
        }
        return f;
    }

    //96*96/8
    public void drawBitmap(byte[] bitmaparray, int bytes)
    {
        byte c, bit1, bit2;

        AddressingMode localAddressMode = addressingMode;

        //Bitmap is drawn in horizontal mode
        if (addressingMode != AddressingMode.Horizontal)
        {
            setHorizontalMode();
        }

        for (int i = 0; i < bytes; i++)
        {

            for (int j = 0; j < 8; j = j + 2)
            {
                c = 0x00;
                bit1 = (byte)(bitmaparray[i] << j & 0x80);
                bit2 = (byte)(bitmaparray[i] << (j + 1) & 0x80);

                // Each bit is changed to a nibble
                c |= (byte)((bit1 == 0) ? grayH : 0x00);
                // Each bit is changed to a nibble
                c |= (byte)((bit2 == 0) ? grayL : 0x00);
                sendData(c);
            }
        }

        //If Vertical Mode was used earlier, restore it.
        if (localAddressMode == AddressingMode.Vertical)
        {
            setVerticalMode();
        }
    }

    public void setHorizontalScrollProperties(ScrollDirection direction, byte startRow, byte endRow, byte startColumn, byte endColumn, ScrollSpeed scrollSpeed)
    {

        if (direction == ScrollDirection.Right)
        {
            //Scroll Right
            sendCommand(0x27);
        }
        else
        {
            //Scroll Left  
            sendCommand(0x26);
        }

        sendCommand(0x00); //dummy     
        sendCommand(startRow);
        sendCommand((byte)scrollSpeed);
        sendCommand(endRow);
        sendCommand((byte)(startColumn + 8));
        sendCommand((byte)(endColumn + 8));
        sendCommand(0x00);     //dummy 
    }

    public void activateScroll()
    {
        sendCommand(Activate_Scroll_Cmd);
    }

    public void deactivateScroll()
    {
        sendCommand(Deactivate_Scroll_Cmd);
    }

    public void setDisplayMode(DisplayMode displayMode)
    {
        if (displayMode == DisplayMode.Normal)
        {
            sendCommand(Normal_Display_Cmd);
        }
        else
        {
            sendCommand(Inverse_Display_Cmd);
        }
    }

    public void Dispose()
    {
        device.Dispose();
    }

    public void drawSomething()
    {
        byte c, grayhigh, graylow;

        setHorizontalMode();
        for (int i = 0; i < (96 * 96);i=i+2)
        {
            c = 0x00;
            grayhigh = (byte)(i % 16);
            graylow = (byte)((i+1) % 16);
            c |= (byte)(grayhigh << 4);
            c |= graylow;

            sendData(c);
        }
    }

    public void drawNoise()
    {
        // need seed to get another noise
        int seed = 0;
        Random rnd = new Random( seed );

        setHorizontalMode();

        for (int i = 0; i < (96 * 96); i = i + 2)
        {
            byte c = 0x00;
            byte grayhigh = (byte) (rnd.Next() % 16);
            byte graylow = (byte)(rnd.Next() % 16);
            c |= (byte)(grayhigh << 4);
            c |= graylow;

            sendData(c);
        }
    }

    // 8x8 Font ASCII 32 - 127 Implemented
    // Users can modify this to support more characters(glyphs)
    // BasicFont is placed in code memory.

    // This font can be freely used without any restriction(It is placed in public domain)
    public byte[][] BasicFont =
    new byte[][]{
        new byte[] {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
        new byte[] {0x00,0x00,0x5F,0x00,0x00,0x00,0x00,0x00},
        new byte[] {0x00,0x00,0x07,0x00,0x07,0x00,0x00,0x00},
        new byte[] {0x00,0x14,0x7F,0x14,0x7F,0x14,0x00,0x00},
        new byte[] {0x00,0x24,0x2A,0x7F,0x2A,0x12,0x00,0x00},
        new byte[] {0x00,0x23,0x13,0x08,0x64,0x62,0x00,0x00},
        new byte[] {0x00,0x36,0x49,0x55,0x22,0x50,0x00,0x00},
        new byte[] {0x00,0x00,0x05,0x03,0x00,0x00,0x00,0x00},
        new byte[] {0x00,0x1C,0x22,0x41,0x00,0x00,0x00,0x00},
        new byte[] {0x00,0x41,0x22,0x1C,0x00,0x00,0x00,0x00},
        new byte[] {0x00,0x08,0x2A,0x1C,0x2A,0x08,0x00,0x00},
        new byte[] {0x00,0x08,0x08,0x3E,0x08,0x08,0x00,0x00},
        new byte[] {0x00,0xA0,0x60,0x00,0x00,0x00,0x00,0x00},
        new byte[] {0x00,0x08,0x08,0x08,0x08,0x08,0x00,0x00},
        new byte[] {0x00,0x60,0x60,0x00,0x00,0x00,0x00,0x00},
        new byte[] {0x00,0x20,0x10,0x08,0x04,0x02,0x00,0x00},
        new byte[] {0x00,0x3E,0x51,0x49,0x45,0x3E,0x00,0x00},
        new byte[] {0x00,0x00,0x42,0x7F,0x40,0x00,0x00,0x00},
        new byte[] {0x00,0x62,0x51,0x49,0x49,0x46,0x00,0x00},
        new byte[] {0x00,0x22,0x41,0x49,0x49,0x36,0x00,0x00},
        new byte[] {0x00,0x18,0x14,0x12,0x7F,0x10,0x00,0x00},
        new byte[] {0x00,0x27,0x45,0x45,0x45,0x39,0x00,0x00},
        new byte[] {0x00,0x3C,0x4A,0x49,0x49,0x30,0x00,0x00},
        new byte[] {0x00,0x01,0x71,0x09,0x05,0x03,0x00,0x00},
        new byte[] {0x00,0x36,0x49,0x49,0x49,0x36,0x00,0x00},
        new byte[] {0x00,0x06,0x49,0x49,0x29,0x1E,0x00,0x00},
        new byte[] {0x00,0x00,0x36,0x36,0x00,0x00,0x00,0x00},
        new byte[] {0x00,0x00,0xAC,0x6C,0x00,0x00,0x00,0x00},
        new byte[] {0x00,0x08,0x14,0x22,0x41,0x00,0x00,0x00},
        new byte[] {0x00,0x14,0x14,0x14,0x14,0x14,0x00,0x00},
        new byte[] {0x00,0x41,0x22,0x14,0x08,0x00,0x00,0x00},
        new byte[] {0x00,0x02,0x01,0x51,0x09,0x06,0x00,0x00},
        new byte[] {0x00,0x32,0x49,0x79,0x41,0x3E,0x00,0x00},
        new byte[] {0x00,0x7E,0x09,0x09,0x09,0x7E,0x00,0x00},
        new byte[] {0x00,0x7F,0x49,0x49,0x49,0x36,0x00,0x00},
        new byte[] {0x00,0x3E,0x41,0x41,0x41,0x22,0x00,0x00},
        new byte[] {0x00,0x7F,0x41,0x41,0x22,0x1C,0x00,0x00},
        new byte[] {0x00,0x7F,0x49,0x49,0x49,0x41,0x00,0x00},
        new byte[] {0x00,0x7F,0x09,0x09,0x09,0x01,0x00,0x00},
        new byte[] {0x00,0x3E,0x41,0x41,0x51,0x72,0x00,0x00},
        new byte[] {0x00,0x7F,0x08,0x08,0x08,0x7F,0x00,0x00},
        new byte[] {0x00,0x41,0x7F,0x41,0x00,0x00,0x00,0x00},
        new byte[] {0x00,0x20,0x40,0x41,0x3F,0x01,0x00,0x00},
        new byte[] {0x00,0x7F,0x08,0x14,0x22,0x41,0x00,0x00},
        new byte[] {0x00,0x7F,0x40,0x40,0x40,0x40,0x00,0x00},
        new byte[] {0x00,0x7F,0x02,0x0C,0x02,0x7F,0x00,0x00},
        new byte[] {0x00,0x7F,0x04,0x08,0x10,0x7F,0x00,0x00},
        new byte[] {0x00,0x3E,0x41,0x41,0x41,0x3E,0x00,0x00},
        new byte[] {0x00,0x7F,0x09,0x09,0x09,0x06,0x00,0x00},
        new byte[] {0x00,0x3E,0x41,0x51,0x21,0x5E,0x00,0x00},
        new byte[] {0x00,0x7F,0x09,0x19,0x29,0x46,0x00,0x00},
        new byte[] {0x00,0x26,0x49,0x49,0x49,0x32,0x00,0x00},
        new byte[] {0x00,0x01,0x01,0x7F,0x01,0x01,0x00,0x00},
        new byte[] {0x00,0x3F,0x40,0x40,0x40,0x3F,0x00,0x00},
        new byte[] {0x00,0x1F,0x20,0x40,0x20,0x1F,0x00,0x00},
        new byte[] {0x00,0x3F,0x40,0x38,0x40,0x3F,0x00,0x00},
        new byte[] {0x00,0x63,0x14,0x08,0x14,0x63,0x00,0x00},
        new byte[] {0x00,0x03,0x04,0x78,0x04,0x03,0x00,0x00},
        new byte[] {0x00,0x61,0x51,0x49,0x45,0x43,0x00,0x00},
        new byte[] {0x00,0x7F,0x41,0x41,0x00,0x00,0x00,0x00},
        new byte[] {0x00,0x02,0x04,0x08,0x10,0x20,0x00,0x00},
        new byte[] {0x00,0x41,0x41,0x7F,0x00,0x00,0x00,0x00},
        new byte[] {0x00,0x04,0x02,0x01,0x02,0x04,0x00,0x00},
        new byte[] {0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00},
        new byte[] {0x00,0x01,0x02,0x04,0x00,0x00,0x00,0x00},
        new byte[] {0x00,0x20,0x54,0x54,0x54,0x78,0x00,0x00},
        new byte[] {0x00,0x7F,0x48,0x44,0x44,0x38,0x00,0x00},
        new byte[] {0x00,0x38,0x44,0x44,0x28,0x00,0x00,0x00},
        new byte[] {0x00,0x38,0x44,0x44,0x48,0x7F,0x00,0x00},
        new byte[] {0x00,0x38,0x54,0x54,0x54,0x18,0x00,0x00},
        new byte[] {0x00,0x08,0x7E,0x09,0x02,0x00,0x00,0x00},
        new byte[] {0x00,0x18,0xA4,0xA4,0xA4,0x7C,0x00,0x00},
        new byte[] {0x00,0x7F,0x08,0x04,0x04,0x78,0x00,0x00},
        new byte[] {0x00,0x00,0x7D,0x00,0x00,0x00,0x00,0x00},
        new byte[] {0x00,0x80,0x84,0x7D,0x00,0x00,0x00,0x00},
        new byte[] {0x00,0x7F,0x10,0x28,0x44,0x00,0x00,0x00},
        new byte[] {0x00,0x41,0x7F,0x40,0x00,0x00,0x00,0x00},
        new byte[] {0x00,0x7C,0x04,0x18,0x04,0x78,0x00,0x00},
        new byte[] {0x00,0x7C,0x08,0x04,0x7C,0x00,0x00,0x00},
        new byte[] {0x00,0x38,0x44,0x44,0x38,0x00,0x00,0x00},
        new byte[] {0x00,0xFC,0x24,0x24,0x18,0x00,0x00,0x00},
        new byte[] {0x00,0x18,0x24,0x24,0xFC,0x00,0x00,0x00},
        new byte[] {0x00,0x00,0x7C,0x08,0x04,0x00,0x00,0x00},
        new byte[] {0x00,0x48,0x54,0x54,0x24,0x00,0x00,0x00},
        new byte[] {0x00,0x04,0x7F,0x44,0x00,0x00,0x00,0x00},
        new byte[] {0x00,0x3C,0x40,0x40,0x7C,0x00,0x00,0x00},
        new byte[] {0x00,0x1C,0x20,0x40,0x20,0x1C,0x00,0x00},
        new byte[] {0x00,0x3C,0x40,0x30,0x40,0x3C,0x00,0x00},
        new byte[] {0x00,0x44,0x28,0x10,0x28,0x44,0x00,0x00},
        new byte[] {0x00,0x1C,0xA0,0xA0,0x7C,0x00,0x00,0x00},
        new byte[] {0x00,0x44,0x64,0x54,0x4C,0x44,0x00,0x00},
        new byte[] {0x00,0x08,0x36,0x41,0x00,0x00,0x00,0x00},
        new byte[] {0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00},
        new byte[] {0x00,0x41,0x36,0x08,0x00,0x00,0x00,0x00},
        new byte[] {0x00,0x02,0x01,0x01,0x02,0x01,0x00,0x00},
        new byte[] {0x00,0x02,0x05,0x05,0x02,0x00,0x00,0x00} 
    };
}

}

//Program.cs: small program to test the 96x96 seeedstudio OLED twig
using System;
using System.Text;
using System.Threading;

using GHIElectronics.NETMF.FEZ;
using GHIElectronics.NETMF.Hardware;

using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SeeedStudio.Twig;

namespace FEZ_Panda_II_Application1
{
public class Program
{

    static SeeedGrayOled_96x96 oled;

    public static void Main()
    {
        // initialize
        oled = new SeeedGrayOled_96x96();
        oled.setDisplayMode(SeeedGrayOled_96x96.DisplayMode.Normal);
        oled.setHorizontalMode();
        oled.clearDisplay();

        // print numbers
        oled.setDisplayMode(SeeedGrayOled_96x96.DisplayMode.Normal);
        oled.setVerticalMode();
        oled.setTextXY(0, 0);       //Set the cursor to 0th line, 0th Column  
        oled.putNumber(123);        //Print number
        oled.setTextXY(1, 0);       //Set the cursor to 1st line, 0th Column  
        oled.putNumber(0xFFFF);     //Print number
        oled.setTextXY(2, 0);       //Set the cursor to 2nd line, 0th Column  
        oled.putNumber(0xFFFFFFFF); //Print number
        oled.setTextXY(3, 0);       //Set the cursor to 3rd line, 0th Column  
        oled.putNumber(-12345);     //Print number
        
        // set vertical before printing test
        oled.setVerticalMode();
        for (int i = 0; i < 12; i++)
        {
            oled.setTextXY((byte) i, (byte) 0); // set Cursor to ith line, 0th column
            oled.setGrayLevel((byte)i);         // Set Grayscale level. Any number between 0 - 15.
            oled.putString("Hello Seeed!");     // Print Hello World
        }

        // set horizontal and draw some noise
        oled.setHorizontalMode();
        oled.drawNoise();

        // print another bitmap
        oled.drawBitmap(surprise, (96 * 96 / 8));

        // set inverse displaymode
        Thread.Sleep(1000);
        oled.setDisplayMode (SeeedGrayOled_96x96.DisplayMode.Inverse);
        Thread.Sleep(1000);
        oled.setDisplayMode(SeeedGrayOled_96x96.DisplayMode.Normal);

        // let's scroll lower rows!
        oled.deactivateScroll();             // deactivate Scroll before writing any data
        oled.drawBitmap(SeeedLogo, 96*96/8);  // (96 pixels *96 pixels  / 8) bytes
        oled.setHorizontalScrollProperties(SeeedGrayOled_96x96.ScrollDirection.Left,72,95,0,47,SeeedGrayOled_96x96.ScrollSpeed.SpeedA_2x);  //Set the properties of Horizontal Scroll
        oled.activateScroll();               // Activate Scroll

        Thread.Sleep(Timeout.Infinite);
    }
    
    public static byte[] surprise = new byte[] {
        0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0xFD, 0x9E,
        0x3C, 0xC0, 0xF8, 0x3B, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x7F, 0xFE, 0xBF, 0xFF, 0xEF, 0x76,
        0x60, 0x00, 0x00, 0x01, 0x80, 0x00, 0xB9, 0xFF, 0xFD, 0xFF, 0xFE, 0xFF, 0xC8, 0x00, 0x00, 0x01,
        0x80, 0x00, 0x7F, 0xBF, 0xFF, 0xFE, 0xFD, 0xDD, 0xB8, 0x00, 0x00, 0x01, 0x80, 0x00, 0x3F, 0xBF,
        0xFF, 0xEF, 0xFF, 0x77, 0xF0, 0x00, 0x00, 0x01, 0x80, 0x00, 0x07, 0xFF, 0xFB, 0xFF, 0xFF, 0xFF,
        0xD0, 0x00, 0x00, 0x01, 0x80, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xB0, 0x00, 0x00, 0x01,
        0x80, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xF7, 0xDF, 0xE0, 0x00, 0x00, 0x01, 0x80, 0x00, 0x07, 0xBB,
        0xFF, 0xFF, 0xFF, 0xFF, 0x40, 0x00, 0x00, 0x01, 0x80, 0x00, 0x23, 0xBF, 0xFF, 0xFF, 0xBB, 0xFC,
        0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x10, 0xFF, 0xFF, 0xFF, 0xF7, 0xFF, 0x00, 0x00, 0x00, 0x01,
        0x80, 0x00, 0x0F, 0xDD, 0xFF, 0xFF, 0xDE, 0x7E, 0x40, 0x00, 0x00, 0x01, 0x80, 0x00, 0x06, 0xFC,
        0xFF, 0xFF, 0xF9, 0xEF, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x01, 0xEF, 0x7F, 0xFF, 0xFF, 0xBE,
        0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x7F, 0xBF, 0xFF, 0xFF, 0x7F, 0x80, 0x00, 0x00, 0x01,
        0x80, 0x00, 0x00, 0x20, 0xFB, 0xFF, 0xBD, 0x7F, 0xC0, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x60,
        0x3F, 0x7E, 0xFE, 0xF8, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0xF3, 0x8F, 0xFD, 0xFF, 0xFF,
        0xC0, 0x00, 0x00, 0x01, 0x80, 0x00, 0x01, 0x80, 0x63, 0xF7, 0xEF, 0xFF, 0x00, 0x00, 0x00, 0x01,
        0x80, 0x00, 0x02, 0x00, 0x11, 0xFF, 0xDF, 0xFE, 0xC0, 0x00, 0x00, 0x01, 0x80, 0x00, 0x04, 0x00,
        0x00, 0x7F, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x01, 0x80, 0x00, 0x08, 0x00, 0x08, 0x3F, 0xFF, 0x39,
        0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x08, 0x00, 0x04, 0x0F, 0xF9, 0xFF, 0x00, 0x00, 0x00, 0x01,
        0x80, 0x00, 0x00, 0x00, 0x04, 0x03, 0xFF, 0xFC, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00,
        0x04, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x10, 0x0C, 0x04, 0x3C, 0x3F, 0x80,
        0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x10, 0x0E, 0x06, 0x81, 0x90, 0x00, 0x00, 0x00, 0x00, 0x01,
        0x80, 0x00, 0x10, 0x0C, 0x06, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x30, 0x00,
        0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x28, 0x00, 0x00, 0x00, 0x10, 0x00,
        0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x48, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x01,
        0x80, 0x00, 0x84, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x84, 0x00,
        0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x01, 0x02, 0x00, 0x20, 0x00, 0x04, 0x00,
        0x00, 0x00, 0x00, 0x01, 0x80, 0x02, 0x01, 0x83, 0xE0, 0x1C, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01,
        0x80, 0x02, 0x00, 0x7E, 0x30, 0x1C, 0x04, 0x00, 0x7F, 0x80, 0x00, 0x01, 0x80, 0x04, 0x00, 0x70,
        0x10, 0x08, 0x04, 0x01, 0x80, 0x7C, 0x00, 0x01, 0x80, 0x04, 0x00, 0xC0, 0x08, 0x00, 0x04, 0x04,
        0x00, 0x03, 0x80, 0x01, 0x80, 0x08, 0x01, 0x80, 0x08, 0x00, 0x00, 0x18, 0x00, 0x1F, 0xFC, 0x01,
        0x80, 0x10, 0x03, 0x00, 0x0C, 0x00, 0x08, 0x20, 0x00, 0x7E, 0xF8, 0x01, 0x80, 0x10, 0x02, 0x00,
        0x0C, 0x00, 0x10, 0x40, 0x00, 0xE0, 0x1F, 0x81, 0x80, 0x20, 0x06, 0x00, 0x0E, 0x00, 0x20, 0x80,
        0x03, 0x80, 0x1B, 0x41, 0x80, 0x20, 0x0C, 0x00, 0x1D, 0x00, 0x41, 0x00, 0x07, 0x00, 0x1B, 0xA1,
        0x80, 0x40, 0x7C, 0x00, 0x1C, 0xC1, 0x03, 0x00, 0x06, 0x00, 0x18, 0xD1, 0x80, 0x81, 0xFC, 0x00,
        0x3C, 0x88, 0x02, 0x0C, 0x0E, 0x00, 0x18, 0x61, 0x80, 0x87, 0xF8, 0x00, 0x7D, 0x00, 0x04, 0xFF,
        0xFC, 0x00, 0x30, 0x29, 0x81, 0x1F, 0xFC, 0x01, 0xFE, 0x00, 0x0F, 0x83, 0xFE, 0x00, 0x60, 0x29,
        0x82, 0x3F, 0xFE, 0x07, 0xFA, 0x00, 0x0E, 0x00, 0xE7, 0x01, 0xC0, 0x09, 0x82, 0x7F, 0xFF, 0xFF,
        0xFC, 0x00, 0x08, 0x00, 0xC3, 0xCF, 0x80, 0x11, 0xF4, 0xFF, 0xFF, 0xFF, 0xF8, 0x00, 0x18, 0x00,
        0xC0, 0xFE, 0x00, 0x21, 0x88, 0xFF, 0xFF, 0xFF, 0xE8, 0x00, 0x10, 0x00, 0xC0, 0x00, 0x00, 0x11,
        0x98, 0xC0, 0x0F, 0xFF, 0xD0, 0x00, 0x20, 0x01, 0x80, 0x00, 0x00, 0x11, 0xB0, 0x00, 0x01, 0xFF,
        0x90, 0x00, 0x60, 0x01, 0x80, 0x00, 0x00, 0x09, 0xB0, 0x00, 0x00, 0xFF, 0x20, 0x00, 0xE0, 0x03,
        0x00, 0x00, 0x00, 0x09, 0xA0, 0x00, 0x00, 0x3F, 0x20, 0x00, 0xF0, 0x07, 0x00, 0x00, 0x00, 0x09,
        0xB0, 0x00, 0x00, 0x1F, 0x40, 0x00, 0xF8, 0x1C, 0x00, 0x00, 0x00, 0x09, 0xB0, 0x00, 0x00, 0x1F,
        0x40, 0x00, 0x9F, 0xF8, 0x00, 0x00, 0x00, 0x09, 0xB0, 0x00, 0x00, 0x0E, 0x80, 0x01, 0x0F, 0xC0,
        0x00, 0x00, 0x00, 0x09, 0xB0, 0x00, 0x00, 0x0E, 0x80, 0x01, 0x40, 0x00, 0x00, 0x04, 0x00, 0x09,
        0x90, 0x00, 0x00, 0x07, 0x00, 0x01, 0x80, 0x00, 0x00, 0x04, 0x00, 0x09, 0xB8, 0x00, 0x00, 0x05,
        0x00, 0x01, 0x80, 0x00, 0x00, 0x1C, 0x80, 0x09, 0xB8, 0x00, 0x00, 0x06, 0x00, 0x01, 0xC0, 0x00,
        0x00, 0x71, 0x80, 0x09, 0x98, 0x00, 0x00, 0x02, 0x00, 0x01, 0x40, 0x00, 0x00, 0xE3, 0x80, 0x01,
        0x9C, 0x00, 0x00, 0x04, 0x00, 0x00, 0xE0, 0x00, 0x1B, 0x87, 0x00, 0x11, 0x8E, 0x00, 0x00, 0x04,
        0x00, 0x00, 0xA0, 0x00, 0x0F, 0x1E, 0x00, 0x11, 0x87, 0x00, 0x00, 0x08, 0x00, 0x00, 0x50, 0x00,
        0x00, 0x3C, 0x00, 0x01, 0x83, 0x80, 0x00, 0x08, 0x00, 0x00, 0x30, 0x00, 0x01, 0xF0, 0x07, 0x21,
        0x80, 0xE0, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x03, 0xC0, 0x0F, 0xE3, 0x80, 0x38, 0x00, 0x18,
        0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x31, 0x80, 0xFE, 0x00, 0x36, 0x00, 0x00, 0x08, 0x00,
        0x00, 0x00, 0x08, 0x19, 0x81, 0xFF, 0xC0, 0x3A, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x0D,
        0x83, 0xFF, 0x7F, 0xEE, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x03, 0x86, 0xFF, 0xFD, 0xFE,
        0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x01, 0x8C, 0xFF, 0xFC, 0x3A, 0x00, 0x00, 0x00, 0x80,
        0x00, 0x00, 0x3C, 0x01, 0x8B, 0xFF, 0xFE, 0x3E, 0x00, 0x00, 0x00, 0x60, 0x00, 0x01, 0xC2, 0x01,
        0xDE, 0xFF, 0xFE, 0x15, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x07, 0x03, 0xE1, 0xB4, 0xFF, 0xFE, 0x1C,
        0x80, 0x00, 0x00, 0x0D, 0x80, 0x78, 0x1C, 0x31, 0xB8, 0x7F, 0xFE, 0x18, 0x80, 0x00, 0x00, 0x10,
        0xFF, 0xC0, 0x20, 0x01, 0xB0, 0x7F, 0xFE, 0x10, 0x00, 0x00, 0x00, 0x20, 0x40, 0x0F, 0xC0, 0x01,
        0xB0, 0x3F, 0xFA, 0x20, 0x40, 0x00, 0x00, 0x40, 0x20, 0xFF, 0x80, 0x01, 0x90, 0x1F, 0xF6, 0x40,
        0x40, 0x00, 0x00, 0x80, 0x21, 0xFF, 0x80, 0x01, 0x90, 0x1F, 0xEE, 0xC0, 0x00, 0x00, 0x03, 0x00,
        0x21, 0xFF, 0x80, 0x21, 0x90, 0x3F, 0xCF, 0x80, 0x20, 0x00, 0x05, 0x00, 0x61, 0x7F, 0x81, 0xF9,
        0x90, 0x3F, 0xDF, 0x00, 0x20, 0x00, 0x09, 0x80, 0xD3, 0xFF, 0xE3, 0x7D, 0x90, 0x7F, 0xCE, 0x00,
        0x20, 0x00, 0x22, 0xC1, 0x8C, 0x7F, 0xFC, 0xF9, 0x90, 0x7F, 0xC6, 0x00, 0x10, 0x00, 0x42, 0x3F,
        0x00, 0x3F, 0xC1, 0x81, 0x90, 0x7F, 0xCC, 0x00, 0x30, 0x00, 0x44, 0x0D, 0x80, 0x17, 0xE2, 0x01,
        0x88, 0xFF, 0x88, 0x01, 0xC0, 0x00, 0x84, 0x00, 0xC8, 0x17, 0xE2, 0x01, 0x88, 0xFF, 0x98, 0x0F,
        0x40, 0x00, 0x04, 0x00, 0x4C, 0x1F, 0xE4, 0x01, 0x89, 0xFF, 0xB0, 0x10, 0x20, 0x01, 0x04, 0x00,
        0x64, 0x1F, 0xF4, 0x01, 0x89, 0xFF, 0xA0, 0x18, 0x20, 0x01, 0x04, 0x00, 0x64, 0x1F, 0xF2, 0x07,
        0x89, 0xFF, 0xA0, 0x18, 0x10, 0x01, 0x06, 0x00, 0x46, 0x2F, 0xF1, 0xF9, 0x87, 0xFF, 0xC0, 0x08,
        0x10, 0x00, 0x85, 0xC0, 0xC3, 0xCF, 0xF3, 0xE1, 0x87, 0xFF, 0xC0, 0x08, 0x10, 0x00, 0x80, 0x7F,
        0x81, 0x0F, 0xFB, 0xC1, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
    };

    public static byte[] SeeedLogo = new byte[] {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x60, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x06, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x01, 0xC0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x03, 0x80, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x03, 0x80,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x03, 0xC0, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x01, 0xC0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
        0x07, 0x80, 0x01, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x0F, 0x80, 0x01, 0xE0,
        0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0F, 0x00, 0x01, 0xE0, 0x08, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x30, 0x0F, 0x00, 0x01, 0xE0, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
        0x0F, 0x00, 0x01, 0xE0, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0F, 0x00, 0x01, 0xE0,
        0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x0F, 0x00, 0x01, 0xE0, 0x18, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x38, 0x0F, 0x00, 0x01, 0xE0, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38,
        0x0F, 0x80, 0x01, 0xE0, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x0F, 0x80, 0x01, 0xE0,
        0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x0F, 0x80, 0x03, 0xE0, 0x78, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x1E, 0x07, 0x80, 0x03, 0xE0, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E,
        0x07, 0x80, 0x03, 0xE0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x07, 0x80, 0x03, 0xC1,
        0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x87, 0xC0, 0x07, 0xC1, 0xF0, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x0F, 0x83, 0xC0, 0x07, 0x83, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F,
        0xC3, 0xC0, 0x07, 0x87, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xE1, 0xE0, 0x07, 0x0F,
        0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xF0, 0xE0, 0x0F, 0x0F, 0x80, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x01, 0xF8, 0xF0, 0x0E, 0x1F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
        0xF8, 0x70, 0x1C, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x30, 0x18, 0x7E,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x18, 0x30, 0xFC, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x1F, 0x88, 0x21, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x0F, 0xC4, 0x47, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xE0, 0x0F, 0x80,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x02, 0x00, 0x06, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06,
        0x00, 0x00, 0x60, 0x00, 0x7E, 0x3F, 0x0F, 0xC3, 0xF0, 0xFA, 0x0F, 0xDF, 0xE1, 0x9F, 0xEC, 0x7E,
        0xE6, 0x73, 0x9C, 0xE7, 0x39, 0xCE, 0x1C, 0xDF, 0xE1, 0xB9, 0xEC, 0xE7, 0xE0, 0x61, 0xD8, 0x66,
        0x1B, 0x86, 0x1C, 0x06, 0x61, 0xB0, 0x6D, 0xC3, 0x7C, 0x7F, 0xFF, 0xFF, 0xFF, 0x06, 0x0F, 0x86,
        0x61, 0xB0, 0x6D, 0x83, 0x3E, 0x7F, 0xFF, 0xFF, 0xFF, 0x06, 0x07, 0xC6, 0x61, 0xB0, 0x6D, 0x83,
        0xC3, 0x61, 0x18, 0x46, 0x03, 0x86, 0x18, 0x66, 0x61, 0xB0, 0x6D, 0xC3, 0xFE, 0x7F, 0x9F, 0xE7,
        0xF9, 0xFE, 0x1F, 0xE6, 0x3F, 0x9F, 0xEC, 0xFE, 0x7E, 0x3F, 0x0F, 0xC3, 0xF0, 0xFA, 0x0F, 0xC6,
        0x3F, 0x9F, 0xEC, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00,
        0x00, 0x20, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x20, 0x82, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0xF3, 0xCF, 0x70, 0x9E, 0x79, 0xE7, 0x80, 0x00, 0x00,
        0x00, 0x00, 0x7D, 0x9E, 0x68, 0x20, 0xB2, 0xC8, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x9E,
        0x6F, 0x20, 0xB2, 0xF9, 0xE7, 0x80, 0x00, 0x00, 0x00, 0x00, 0x46, 0x9A, 0x61, 0x20, 0xB2, 0xCB,
        0x60, 0x80, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xF3, 0xCF, 0x30, 0x9E, 0x79, 0xE7, 0x90, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x02, 0x00, 0x00, 0x82, 0x60, 0x00, 0x00,
        0xF8, 0x00, 0x00, 0x40, 0x40, 0x02, 0x00, 0x00, 0x83, 0x60, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x40,
        0x60, 0xB7, 0x79, 0xE7, 0x81, 0xC7, 0x92, 0x70, 0x89, 0xE7, 0x9E, 0x78, 0x7C, 0xE2, 0xC9, 0x2C,
        0x81, 0xCC, 0xD2, 0x40, 0xFB, 0x21, 0xB2, 0x48, 0x40, 0x62, 0xF9, 0x2C, 0x80, 0x8C, 0xD2, 0x40,
        0x8B, 0xE7, 0xB0, 0x48, 0x40, 0xE2, 0xC9, 0x2C, 0x80, 0x84, 0xD2, 0x40, 0x8B, 0x2D, 0x92, 0x48,
        0x7D, 0xB3, 0x79, 0x27, 0x80, 0x87, 0x9E, 0x40, 0x8D, 0xE7, 0x9E, 0x48, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
    };
}

}

Hi,

Back again playing with 96x96 OLED. This time not with the FEZ Panda II, but with a Seeeduino v2.21.

I forgot to UNPATCH my wire.h. Reason I patched is to get the Rainbowduino up-and-running.

Took me 2 hours to figure this out :imp:

Now I get my Hello World, so guess it’s ok now :slight_smile:

Merijn