Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <OLED_I2C.h>
- #define WIDTH 128
- #define HEIGHT 44
- OLED myOLED(A4, A5, A4);
- byte pixel[704];
- void setup() {
- myOLED.begin();
- for (int i = 0; i < (WIDTH * HEIGHT) / sizeof(byte); i++) {
- pixel[i] = random(0,256);
- }
- }
- void loop() {
- myOLED.clrScr();
- for (int i = 0; i < WIDTH * HEIGHT; i++) {
- if ( ( pixel[ (int)floor(i / 8) ] ) & ( 128 >> (i % 8 ) ) ) {
- myOLED.setPixel(i % WIDTH, (int)floor(i / WIDTH) );
- }
- }
- myOLED.update();
- delay(500);
Advertisement
Add Comment
Please, Sign In to add comment