Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed Adafruit_GFX
main.cpp
- Committer:
 - javiervicente
 - Date:
 - 2020-12-01
 - Revision:
 - 0:72e26a9c09f9
 - Child:
 - 1:a32b2b0960ac
 
File content as of revision 0:72e26a9c09f9:
#include "mbed.h"
#include "Adafruit_SSD1306.h"
class I2CPreInit : public I2C
{
public:
    I2CPreInit(PinName sda, PinName scl) : I2C(sda, scl)
    {
        frequency(100000);
        start();
    };
};
I2CPreInit gI2C(PB_9,PB_8);
// an SPI sub-class that provides a constructed default
Adafruit_SSD1306_I2c gOled(gI2C,NC,0x78,64,128);
Serial pc(USBTX, USBRX);
int main()
{
    int n=0;
    gOled.begin();
    gOled.clearDisplay();
    while (1) {
        gOled.printf("Hola\n");
         gOled.printf("numero %d\n",n);
         n++;
        gOled.display();
        gOled.setTextCursor(0,0);
        thread_sleep_for(1000);
    }
}