irira=

Dependencies:   Adafruit_GFX mbed

Fork of I2C_SSD1306_Helloworld_WIZwiki-W7500 by IOP

main.cpp

Committer:
IOP
Date:
2015-07-24
Revision:
8:e61e86355653
Parent:
7:4ab5e8203b1d
Child:
9:a6021ca48d2e

File content as of revision 8:e61e86355653:

#include "mbed.h"
#include "Adafruit_SSD1306.h"

DigitalOut shield_led_off(D10); 
DigitalOut myled_R(LED1);


// an SPI sub-class that provides a constructed default
class I2CPreInit : public I2C
{
public:
    I2CPreInit(PinName sda, PinName scl) : I2C(sda, scl)
    {
        frequency(100000);
        start();
    };
};

I2CPreInit gI2C(PA_10,PA_9);
Adafruit_SSD1306_I2c gOled(gI2C,NC,0x78,64,128);
Serial pc(USBTX,USBRX);

int main()
{   uint16_t x=0;

    shield_led_off = 0; // turn off Green LED on shield
 
    gOled.begin();
    gOled.printf("%ux%u Hellow World\r\n", gOled.width(), gOled.height());
    gOled.display();


    while(1)
    {
        myled_R = !myled_R;
        gOled.printf("%u\r",x);
        gOled.display();
        x = x + 1;
        wait(1);
    }
}