Created
January 24, 2017 14:30
-
-
Save kashimAstro/ad806aaa9e9ded839930d63707b30a77 to your computer and use it in GitHub Desktop.
OLED i2c 128x64 script test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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