FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

IO: Invert OLED example · morikoh/processing@8b4373b · GitHub

Repository navigation

Commit 8b4373b

Browse files
committed
IO: Invert OLED example
This makes bright pixels be illuminated on the display.
1 parent cde0859 commit 8b4373b

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

‎java/libraries/io/examples/I2CScreen/I2CScreen.pde‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ void setup() {
1414
}
1515

1616
void draw() {
17-
background(255);
17+
background(0);
18+
stroke(255);
1819
line(0, 0, 127, 63);
1920
line(0, 63, 127, 0);
2021
oled.sendImage(get());

‎java/libraries/io/examples/I2CScreen/SSD1306.pde‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class SSD1306 extends I2C {
6161
img.loadPixels();
6262
for (int y=startY; y < height && y-startY < 64; y++) {
6363
for (int x=startX; x < width && x-startX < 128; x++) {
64-
if (brightness(img.pixels[y*img.width+x]) < 128) {
64+
if (128 <= brightness(img.pixels[y*img.width+x])) {
6565
// this isn't the normal (scanline) mapping, but 8 pixels below each other at a time
6666
// white pixels have their bit turned on
6767
frame[x + (y/8)*128] |= (1 << (y % 8));

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL