Last active
December 18, 2016 21:11
-
-
Save spitty/8f62e84276f0f320e53b66a7631dc2a5 to your computer and use it in GitHub Desktop.
Arduino IDE sketch
This file contains hidden or 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
| /* | |
| This Arduino sketch shows QR-code with word 'AMAZING' and a heart | |
| in the right side of GLCD-display. | |
| Library openGLCD https://bitbucket.org/bperrybap/openglcd/wiki/Home | |
| is used. | |
| Author: Maxim Logunov [email protected] | |
| Date: 2016-12-17 | |
| */ | |
| #include <openGLCD.h> | |
| #define RECTSIZE 21 | |
| #define PXSIZE 2 | |
| const int bits[RECTSIZE][RECTSIZE] = {{0,0,0,0,0,0,0,1,0,1,1,0,1,1,0,0,0,0,0,0,0}, | |
| {0,1,1,1,1,1,0,1,1,0,1,1,0,1,0,1,1,1,1,1,0}, | |
| {0,1,0,0,0,1,0,1,1,0,1,1,1,1,0,1,0,0,0,1,0}, | |
| {0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0}, | |
| {0,1,0,0,0,1,0,1,1,1,1,0,1,1,0,1,0,0,0,1,0}, | |
| {0,1,1,1,1,1,0,1,1,0,1,0,0,1,0,1,1,1,1,1,0}, | |
| {0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0}, | |
| {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, | |
| {1,1,0,1,0,0,1,1,0,0,1,0,0,1,1,1,1,0,1,1,0}, | |
| {1,0,1,0,0,0,1,0,0,0,0,0,0,0,1,1,1,0,1,0,1}, | |
| {0,1,1,1,0,1,1,0,0,0,0,0,0,0,1,1,0,0,1,1,1}, | |
| {1,0,1,1,1,0,1,1,0,0,0,0,0,1,1,1,1,1,0,1,1}, | |
| {0,0,0,1,0,0,0,1,1,0,0,0,1,1,1,1,0,1,0,0,1}, | |
| {1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,0,1,0,0,1,1}, | |
| {0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,1,1,1,1,1}, | |
| {0,1,1,1,1,1,0,1,0,0,1,1,0,0,0,0,0,1,0,1,0}, | |
| {0,1,0,0,0,1,0,1,0,1,1,1,1,0,1,0,1,0,0,1,0}, | |
| {0,1,0,0,0,1,0,1,1,1,0,0,1,1,0,0,1,0,1,0,1}, | |
| {0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,1,0,1,0,1,0}, | |
| {0,1,1,1,1,1,0,1,1,0,0,1,1,0,0,0,1,1,1,0,0}, | |
| {0,0,0,0,0,0,0,1,1,1,0,0,1,0,0,1,0,0,0,1,0}}; | |
| void setup() | |
| { | |
| GLCD.Init(); | |
| GLCD.ClearScreen(); | |
| } | |
| void loop() | |
| { | |
| for (int i = 0; i < RECTSIZE; i++) { | |
| for (int j = 0; j < RECTSIZE; j++) { | |
| uint8_t color = (bits[i][j] == 0 ? PIXEL_ON : PIXEL_OFF); | |
| // padding-top : 11 = (64 - RECTSIZE * PXSIZE) / 2 | |
| // padding-left : 75 = WIDTH / 2 + (64 - RECTSIZE * PXSIZE) / 2 | |
| GLCD.FillRect(75 + j * PXSIZE, 11 + i * PXSIZE, 2, 2, color); | |
| } | |
| } | |
| delay(1000); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment