Skip to content

Instantly share code, notes, and snippets.

@kashimAstro
Created January 24, 2017 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kashimAstro/ad806aaa9e9ded839930d63707b30a77 to your computer and use it in GitHub Desktop.
Save kashimAstro/ad806aaa9e9ded839930d63707b30a77 to your computer and use it in GitHub Desktop.
OLED i2c 128x64 script test
#include <iostream>
#include "ofxGPIO.h"
#define OLED 0x3C
#define WIDTH_OLED 128
#define HEIGHT_OLED 64
int main(int argc, char *argv[])
{
if(argc > 2)
{
int a = strtol(argv[1], NULL, 16);
int b = strtol(argv[2], NULL, 16);
I2CBus * bus;
bus = new I2CBus("/dev/i2c-1");
bus->addressSet(OLED);
for (int i = 0; i < (( WIDTH_OLED * HEIGHT_OLED / 8 ) / 16); i++)
{
bus->writeByte(a, b);
}
}
return 0;
}
@kashimAstro
Copy link
Author

g++ -Wall -o oled OLEDpi.cpp ../src/gpio.cpp ../src/i2cBus.cpp ../src/rpiPWM1.cpp ../src/smbus.cpp -DCOMPILE_WITHOUT_OPENFRAMEWORKS=1 -I../src/ -std=c++11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment