Hardware components | ||||||
![]() |
| × | 1 | |||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 | ||||
![]() |
| × | 4 | |||
![]() |
| × | 1 | |||
| × | 1 | ||||
| × | 1 | ||||
![]() |
| × | 1 | |||
![]() |
| × | 1 | |||
Software apps and online services | ||||||
![]() |
|
I was asked by Blockchain Village founder Ajit to make a badge that represents his vibrant cryptocurrency and blockchain community and gamify a thing or two in the process.
It wasn't too long before I could draw inspiration from old school gaming consoles with the display. I was asked to consider 3 key characteristics:
- Wearable: Users should be able to wear the badge on their wrist.
- Crypto Puzzle: An engaging puzzle based on the ancient cipher.
- Reprogrammable: The badge should be easily programmable again and again.
After experimenting with few form factors, we finalised a horizontal design this time with lanyard cutouts on the top and bottom part and tactile push-button keys on both sides.
That brings us to one of the most sophisticated and elegant designs we have ever made on a single-sided PCB.
Experimenting with the PCBs with few colour combinations bought us a couple of beautiful looking blends. White base colour with Blue personality and vice versa.
And so we settled for the White design with a Blue personality.
After sliding the switch on the top right corner, the badge boots up in the Blockchain logo animation and event details. If you're one of the selected special badge holders, it will also flash your name and designation on the display.
Making It Wearable:
Insert the lanyard from the top cutout then all the way to the bottom cutout - wrapping around your wrist and then back to the top cutout. Feel free to experiment and adjust the lanyard accordingly.
Puzzle Mode:
Press and hold the S1 key for 4 seconds to launch the "Insert Code" mode. On this screen, you can enter your puzzle binary which will lead to the next screen with further clues into the challenge.
You can clear the binary input with the S2 key. Keys to enter binary are on the right side of the badge. The badge responds to the binary automatically as soon as it receives all the (right) binary.
Reprogramming:
All badges are equipped with male headers and pinout for reference.
The only thing required to program the badges is jumper wires and ISP Programmer. Attach the Jumper wires from their corresponding pins to the ISP Programmer connected to the system.
Launch Microchip Studio to program the badge. From there, you can edit the following code or make your own build from scratch.
Once that's done, all you've to do is upload the hex file to the ATmega32A. You can use Microchip Studio if your ISP programmer supports it. If not, there are many third-party softwares available that'll push your code to the ATmega32A.
The Code
The code provided here has some additional features than the one flashed by default on badges.
We wrote all the libraries required from scratch. And were able to make the badge more fun to look at in the process with plenty of font and animation experiments.
This code provides one extra font that users can utilise to showcase all the funky art they want on the display.
There's also a portion of code dedicated to serial communication. Users can build it as per their use to utilise serial communication and maybe, just maybe, at some point it has to do with the Rx-Tx pins on the badge.
Since this code is provided openly, we've removed the badge puzzle from it. So, if the conference is on and you wish to participate in the Blockchain CTF, make sure to not flash your badge with this code until you're done with the CTF. Meanwhile, we've provided a very quick way to flash the badge with the user name. Just replace the highlighted text with your name and designation.
With that said, I look forward to all the crazy experiments that curious minds will do with this badge.
/*
* Blockchain.c
*
* Author : Hackerwares.in
*/
#define F_CPU 2000000UL
#include <avr/io.h>
#include <util/delay.h>
#include <stdlib.h>
#include <avr/pgmspace.h>
int image_cnt=0;
int ioled,joled;
int *icount;
int *icount=&image_cnt;
int password=0;
#define char_pages_required 2
#define char_columns_required 9
#define no_of_bytes_char 21
#define first_char_ascii_code 32
int store_code[40];
//int check_code[8] = {0,0,0,0,1,1,1,1};
const unsigned char bitmap[8][128] PROGMEM ={
{0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,128 ,224 ,192 ,48 ,112 ,240 ,240 ,240 ,240 ,240 ,240 ,240 ,240 ,240 ,240 ,192 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,192 ,224 ,240 ,240 ,240 ,240 ,240 ,240 ,240 ,240 ,240 ,240 ,48 ,192 ,224 ,128 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0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, 0x00, 0x82, 0x00, 0xFE, 0x18, 0x80, 0x07, 0x78, 0x00, 0xC6, 0x1F, 0x40, 0x10, 0xC0, 0x1F, // Code for char %
0x04, 0x7C, 0x0F, 0x82, 0x10, 0x82, 0x10, 0x9C, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char &
0x01, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char '
0x02, 0xFC, 0x0F, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char (
0x02, 0x02, 0x10, 0xFC, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char )
0x04, 0x00, 0x00, 0x04, 0x00, 0x0E, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char *
0x04, 0x00, 0x00, 0x80, 0x00, 0xE0, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char +
0x01, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ,
0x03, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char -
0x01, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char .
0x02, 0x80, 0x1F, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char /
0x04, 0xFC, 0x0F, 0x02, 0x10, 0x02, 0x10, 0xFC, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 0
0x01, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 1
0x04, 0x1C, 0x1F, 0x82, 0x10, 0x42, 0x10, 0x3C, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 2
0x04, 0x1C, 0x0E, 0x42, 0x10, 0x42, 0x10, 0xBC, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 3
0x04, 0xF0, 0x03, 0x08, 0x02, 0xFE, 0x1F, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 4
0x04, 0x7E, 0x0E, 0x42, 0x10, 0x42, 0x10, 0x9E, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 5
0x04, 0xFC, 0x0F, 0x42, 0x10, 0x42, 0x10, 0x9C, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 6
0x04, 0x1E, 0x00, 0x02, 0x1C, 0xE2, 0x03, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 7
0x04, 0xBC, 0x0F, 0x42, 0x10, 0x42, 0x10, 0xBC, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 8
0x04, 0x7C, 0x0E, 0x82, 0x10, 0x82, 0x10, 0xFC, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 9
0x01, 0x80, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char :
0x01, 0x80, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ;
0x04, 0x00, 0x00, 0x40, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char <
0x04, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char =
0x04, 0x00, 0x00, 0xA0, 0x00, 0xA0, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char >
0x04, 0x1C, 0x00, 0x82, 0x1B, 0x42, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ?
0x06, 0xF0, 0x07, 0x18, 0x08, 0xF8, 0x0B, 0xF8, 0x09, 0x08, 0x02, 0xF0, 0x03, 0x00, 0x00, 0x00, 0x00, // Code for char @
0x03, 0xF8, 0x1F, 0x06, 0x01, 0xF8, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char A
0x04, 0xFE, 0x1F, 0x42, 0x10, 0x42, 0x10, 0xBC, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char B
0x04, 0xFC, 0x0F, 0x02, 0x10, 0x02, 0x10, 0x1C, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char C
0x04, 0xFE, 0x1F, 0x02, 0x10, 0x02, 0x10, 0xFC, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char D
0x04, 0xFE, 0x1F, 0x42, 0x10, 0x42, 0x10, 0x1E, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char E
0x03, 0xFE, 0x1F, 0x82, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char F
0x04, 0xFC, 0x0F, 0x02, 0x10, 0x82, 0x10, 0x9C, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char G
0x04, 0xFE, 0x1F, 0x80, 0x00, 0x80, 0x00, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char H
0x01, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char I
0x04, 0x00, 0x0E, 0x00, 0x10, 0x00, 0x10, 0xFE, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char J
0x03, 0xFE, 0x1F, 0xE0, 0x03, 0x1E, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char K
0x03, 0xFE, 0x1F, 0x00, 0x10, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char L
0x07, 0xFE, 0x1F, 0x38, 0x00, 0xC0, 0x03, 0x00, 0x1C, 0xC0, 0x03, 0x38, 0x00, 0xFE, 0x1F, 0x00, 0x00, // Code for char M
0x04, 0xFE, 0x1F, 0x70, 0x00, 0x80, 0x07, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char N
0x04, 0xFC, 0x0F, 0x02, 0x10, 0x02, 0x10, 0xFC, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char O
0x04, 0xFE, 0x1F, 0x82, 0x00, 0x82, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char P
0x04, 0xFC, 0x0F, 0x02, 0x10, 0x02, 0x38, 0xFC, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Q
0x04, 0xFE, 0x1F, 0x82, 0x00, 0x82, 0x00, 0x7C, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char R
0x04, 0x3C, 0x0E, 0x42, 0x10, 0x82, 0x10, 0x1C, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char S
0x05, 0x1E, 0x00, 0x02, 0x00, 0xFE, 0x1F, 0x02, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char T
0x04, 0xFE, 0x0F, 0x00, 0x10, 0x00, 0x10, 0xFE, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char U
0x03, 0xFE, 0x07, 0x00, 0x18, 0xFE, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char V
0x07, 0xFE, 0x07, 0x00, 0x18, 0xF8, 0x07, 0x06, 0x00, 0xF8, 0x07, 0x00, 0x18, 0xFE, 0x07, 0x00, 0x00, // Code for char W
0x03, 0x0E, 0x1E, 0xF0, 0x01, 0x0E, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char X
0x03, 0x3E, 0x00, 0xC0, 0x1F, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Y
0x04, 0x1E, 0x1C, 0x82, 0x13, 0x72, 0x10, 0x0E, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Z
0x02, 0xFE, 0x1F, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char [
0x02, 0x7E, 0x00, 0x80, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char BackSlash
0x02, 0x02, 0x10, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ]
0x05, 0x10, 0x00, 0x0C, 0x00, 0x02, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ^
0x04, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char _
0x03, 0x00, 0x00, 0x02, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char `
0x03, 0x70, 0x1F, 0x10, 0x11, 0xF0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char a
0x04, 0xFE, 0x1F, 0x10, 0x10, 0x10, 0x10, 0xF0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char b
0x04, 0xE0, 0x0F, 0x10, 0x10, 0x10, 0x10, 0x60, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char c
0x04, 0xF0, 0x1F, 0x10, 0x10, 0x10, 0x10, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char d
0x04, 0xE0, 0x0F, 0x10, 0x11, 0x10, 0x11, 0xE0, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char e
0x02, 0xFE, 0x1F, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char f
0x04, 0xF0, 0x5F, 0x10, 0x50, 0x10, 0x50, 0xF0, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char g
0x04, 0xFE, 0x1F, 0x10, 0x00, 0x10, 0x00, 0xF0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char h
0x01, 0xF6, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char i
0x02, 0x00, 0x40, 0xF6, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char j
0x04, 0xFE, 0x1F, 0x80, 0x03, 0x40, 0x0C, 0x30, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char k
0x01, 0xFE, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char l
0x07, 0xF0, 0x1F, 0x10, 0x00, 0x10, 0x00, 0xE0, 0x1F, 0x10, 0x00, 0x10, 0x00, 0xF0, 0x1F, 0x00, 0x00, // Code for char m
0x04, 0xF0, 0x1F, 0x10, 0x00, 0x10, 0x00, 0xF0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char n
0x04, 0xE0, 0x0F, 0x10, 0x10, 0x10, 0x10, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char o
0x04, 0xF0, 0x7F, 0x10, 0x10, 0x10, 0x10, 0xF0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char p
0x04, 0xF0, 0x1F, 0x10, 0x10, 0x10, 0x10, 0xF0, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char q
0x03, 0xF0, 0x1F, 0x10, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char r
0x03, 0x60, 0x0C, 0x90, 0x11, 0x60, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char s
0x03, 0xFE, 0x0F, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char t
0x04, 0xF0, 0x1F, 0x00, 0x10, 0x00, 0x10, 0xF0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char u
0x03, 0xF0, 0x07, 0x00, 0x18, 0xF0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char v
0x07, 0xF0, 0x07, 0x00, 0x18, 0xC0, 0x07, 0x30, 0x00, 0xC0, 0x07, 0x00, 0x18, 0xF0, 0x07, 0x00, 0x00, // Code for char w
0x03, 0x70, 0x18, 0x80, 0x07, 0x70, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char x
0x04, 0xF0, 0x5F, 0x00, 0x50, 0x00, 0x50, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char y
0x03, 0x70, 0x1C, 0x90, 0x13, 0x70, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char z
0x03, 0x40, 0x00, 0xBC, 0x0F, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char {
0x02, 0x00, 0x00, 0xFE, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char |
0x04, 0x00, 0x00, 0x02, 0x10, 0xBC, 0x0F, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char }
0x05, 0xC0, 0x00, 0x40, 0x00, 0x80, 0x00, 0x80, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ~
0x05, 0xFF, 0x1F, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // Code for char
};
const unsigned short font2[] PROGMEM = {
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char
0x04, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x0D, 0xFC, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char !
0x05, 0x1C, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char "
0x08, 0x20, 0x01, 0x20, 0x0D, 0xE0, 0x03, 0x38, 0x01, 0x20, 0x0D, 0xE0, 0x03, 0x38, 0x01, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, // Code for char #
0x06, 0x00, 0x00, 0x38, 0x06, 0x7C, 0x0E, 0xCE, 0x1C, 0xDC, 0x0F, 0x98, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char $
0x09, 0xFC, 0x00, 0x84, 0x00, 0xFC, 0x0C, 0x00, 0x03, 0xC0, 0x00, 0x30, 0x00, 0xCC, 0x0F, 0x40, 0x08, 0xC0, 0x0F, 0x00, 0x00, // Code for char %
0x07, 0x60, 0x07, 0xF0, 0x0F, 0x90, 0x0C, 0xF0, 0x0F, 0x60, 0x07, 0x00, 0x0E, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char &
0x02, 0x1C, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char '
0x03, 0xFC, 0x0F, 0xFC, 0x0F, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char (
0x03, 0x04, 0x08, 0xFC, 0x0F, 0xFC, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char )
0x04, 0x00, 0x00, 0x18, 0x00, 0x0C, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char *
0x07, 0x00, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0xF0, 0x03, 0xF0, 0x03, 0xC0, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char +
0x02, 0x00, 0x1C, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ,
0x04, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char -
0x02, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char .
0x05, 0x00, 0x00, 0x00, 0x0E, 0xE0, 0x0F, 0xFC, 0x01, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char /
0x07, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x07, 0xFC, 0x0F, 0x04, 0x08, 0xFC, 0x0F, 0xF8, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 0
0x06, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0xF8, 0x0F, 0xFC, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 1
0x07, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0C, 0x1C, 0x0F, 0xC4, 0x0F, 0xFC, 0x09, 0x78, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 2
0x07, 0x00, 0x00, 0x00, 0x00, 0x18, 0x07, 0x1C, 0x0F, 0x44, 0x08, 0xFC, 0x0F, 0xB8, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 3
0x08, 0x00, 0x00, 0x80, 0x03, 0xE0, 0x03, 0x78, 0x03, 0x1C, 0x03, 0xFC, 0x0F, 0xFC, 0x0F, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, // Code for char 4
0x07, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x07, 0x7C, 0x0F, 0x24, 0x08, 0xE4, 0x0F, 0xE4, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 5
0x07, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x07, 0xFC, 0x0F, 0x24, 0x08, 0xEC, 0x0F, 0xC8, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 6
0x07, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x0C, 0xE4, 0x0F, 0xFC, 0x03, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 7
0x07, 0x00, 0x00, 0x00, 0x00, 0xB8, 0x07, 0xFC, 0x0F, 0x44, 0x08, 0xFC, 0x0F, 0xB8, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 8
0x07, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x04, 0xFC, 0x0D, 0x04, 0x09, 0xFC, 0x0F, 0xF8, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char 9
0x02, 0x60, 0x0C, 0x60, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char :
0x02, 0x60, 0x1C, 0x60, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ;
0x07, 0x40, 0x00, 0xE0, 0x00, 0xE0, 0x00, 0xF0, 0x01, 0xB0, 0x01, 0xB0, 0x01, 0x18, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char <
0x07, 0xB0, 0x01, 0xB0, 0x01, 0xB0, 0x01, 0xB0, 0x01, 0xB0, 0x01, 0xB0, 0x01, 0xB0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char =
0x07, 0x18, 0x03, 0xB0, 0x01, 0xB0, 0x01, 0xF0, 0x01, 0xE0, 0x00, 0xE0, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char >
0x06, 0xD8, 0x0D, 0xDC, 0x0D, 0x04, 0x01, 0x04, 0x01, 0xFC, 0x01, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ?
0x0A, 0xE0, 0x01, 0x18, 0x06, 0xC8, 0x05, 0x24, 0x0A, 0x14, 0x0A, 0x14, 0x0B, 0xF4, 0x0B, 0x3C, 0x0A, 0x08, 0x05, 0xF0, 0x04, // Code for char @
0x07, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x0F, 0xFC, 0x0F, 0x0C, 0x02, 0xFC, 0x0F, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char A
0x06, 0x00, 0x00, 0xFC, 0x0F, 0xFC, 0x0F, 0x44, 0x08, 0xFC, 0x0F, 0xB8, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char B
0x06, 0x00, 0x00, 0xF8, 0x07, 0xFC, 0x0F, 0x04, 0x08, 0xBC, 0x0F, 0xB8, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char C
0x06, 0x00, 0x00, 0xFC, 0x0F, 0xFC, 0x0F, 0x04, 0x08, 0xFC, 0x0F, 0xF8, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char D
0x07, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x0F, 0xFC, 0x0F, 0x44, 0x08, 0x44, 0x08, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char E
0x06, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x0F, 0xFC, 0x0F, 0x44, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char F
0x07, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x07, 0xFC, 0x0F, 0x04, 0x08, 0xBC, 0x07, 0xB8, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char G
0x07, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x0F, 0xFC, 0x0F, 0x80, 0x00, 0xFC, 0x0F, 0xFC, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char H
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x0F, 0xFC, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char I
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xFC, 0x0F, 0xFC, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char J
0x07, 0x00, 0x00, 0xFC, 0x0F, 0xFC, 0x0F, 0xE0, 0x01, 0xF0, 0x03, 0x1C, 0x0E, 0x0C, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char K
0x06, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x0F, 0xFC, 0x0F, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char L
0x08, 0x00, 0x00, 0xFC, 0x0F, 0xFC, 0x0F, 0x18, 0x00, 0xE0, 0x0F, 0x18, 0x00, 0xFC, 0x0F, 0xFC, 0x0F, 0x00, 0x00, 0x00, 0x00, // Code for char M
0x07, 0x00, 0x00, 0xFC, 0x0F, 0xFC, 0x0F, 0x78, 0x00, 0xC0, 0x03, 0xFC, 0x0F, 0xFC, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char N
0x07, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x07, 0xFC, 0x0F, 0x04, 0x08, 0xFC, 0x0F, 0xF8, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char O
0x07, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x0F, 0xFC, 0x0F, 0x84, 0x00, 0xFC, 0x00, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char P
0x07, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x07, 0xFC, 0x0F, 0x04, 0x08, 0xFC, 0x17, 0xF8, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Q
0x07, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x0F, 0xFC, 0x0F, 0x44, 0x00, 0xFC, 0x0F, 0xB8, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char R
0x07, 0x00, 0x00, 0x00, 0x00, 0x78, 0x06, 0x7C, 0x0E, 0xC4, 0x08, 0xDC, 0x0F, 0x98, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char S
0x07, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0xFC, 0x0F, 0xFC, 0x0F, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char T
0x07, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x07, 0xFC, 0x0F, 0x00, 0x08, 0xFC, 0x0F, 0xFC, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char U
0x07, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x03, 0xFC, 0x0F, 0x00, 0x0C, 0xFC, 0x0F, 0xFC, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char V
0x09, 0x3C, 0x00, 0xFC, 0x0F, 0x00, 0x0C, 0xF0, 0x0F, 0x3C, 0x00, 0xF0, 0x0F, 0x00, 0x0C, 0xFC, 0x0F, 0x3C, 0x00, 0x00, 0x00, // Code for char W
0x08, 0x00, 0x00, 0x1C, 0x0C, 0x3C, 0x0E, 0x60, 0x03, 0xC0, 0x01, 0x60, 0x03, 0x3C, 0x0E, 0x1C, 0x0C, 0x00, 0x00, 0x00, 0x00, // Code for char X
0x07, 0x00, 0x00, 0x0C, 0x00, 0x7C, 0x00, 0xC0, 0x0F, 0xC0, 0x0F, 0x7C, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Y
0x07, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0C, 0x84, 0x0F, 0xF4, 0x0B, 0x7C, 0x08, 0x0C, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char Z
0x03, 0xFC, 0x0F, 0xFC, 0x0F, 0x0C, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char [
0x05, 0x0C, 0x00, 0x7C, 0x00, 0xF0, 0x03, 0x80, 0x0F, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char BackSlash
0x03, 0x0C, 0x0C, 0xFC, 0x0F, 0xFC, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ]
0x07, 0x40, 0x00, 0x70, 0x00, 0x38, 0x00, 0x1C, 0x00, 0x38, 0x00, 0x70, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ^
0x07, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char _
0x03, 0x01, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char `
0x06, 0x00, 0x00, 0x60, 0x0F, 0x70, 0x0F, 0x90, 0x09, 0xF0, 0x0F, 0xE0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char a
0x06, 0x00, 0x00, 0xFC, 0x0F, 0xFC, 0x0F, 0x10, 0x08, 0xF0, 0x0F, 0xF0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char b
0x05, 0x00, 0x00, 0xE0, 0x07, 0xF0, 0x0F, 0x10, 0x08, 0x60, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char c
0x06, 0x00, 0x00, 0xF0, 0x0F, 0xF0, 0x0F, 0x10, 0x08, 0xFC, 0x0F, 0xFC, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char d
0x06, 0x00, 0x00, 0xE0, 0x07, 0xF0, 0x0F, 0x90, 0x08, 0xF0, 0x0E, 0xE0, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char e
0x04, 0x10, 0x00, 0xFC, 0x0F, 0xFC, 0x0F, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char f
0x06, 0x00, 0x00, 0xF0, 0x0B, 0xF0, 0x1B, 0x10, 0x12, 0xF0, 0x1F, 0xF0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char g
0x06, 0x00, 0x00, 0xFC, 0x0F, 0xFC, 0x0F, 0x10, 0x00, 0xF0, 0x0F, 0xF0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char h
0x03, 0x00, 0x00, 0xF4, 0x0F, 0xF4, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char i
0x03, 0x00, 0x10, 0xF4, 0x1F, 0xF4, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char j
0x06, 0x00, 0x00, 0xFC, 0x0F, 0xFC, 0x0F, 0x80, 0x01, 0xF0, 0x0F, 0x10, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char k
0x03, 0x00, 0x00, 0xFC, 0x0F, 0xFC, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char l
0x09, 0x00, 0x00, 0xF0, 0x0F, 0xF0, 0x0F, 0x10, 0x00, 0xF0, 0x0F, 0xF0, 0x0F, 0x10, 0x00, 0xF0, 0x0F, 0xF0, 0x0F, 0x00, 0x00, // Code for char m
0x06, 0x00, 0x00, 0xF0, 0x0F, 0xF0, 0x0F, 0x10, 0x00, 0xF0, 0x0F, 0xF0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char n
0x06, 0x00, 0x00, 0xE0, 0x07, 0xF0, 0x0F, 0x10, 0x08, 0xF0, 0x0F, 0xE0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char o
0x06, 0x00, 0x00, 0xF0, 0x1F, 0xF0, 0x1F, 0x10, 0x08, 0xF0, 0x0F, 0xF0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char p
0x06, 0x00, 0x00, 0xF0, 0x0F, 0xF0, 0x0F, 0x10, 0x08, 0xF0, 0x1F, 0xF0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char q
0x05, 0x00, 0x00, 0xF0, 0x0F, 0xF0, 0x0F, 0x20, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char r
0x05, 0x00, 0x00, 0xE0, 0x06, 0xF0, 0x09, 0x90, 0x0F, 0x60, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char s
0x04, 0x10, 0x00, 0xFC, 0x0F, 0xFC, 0x0F, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char t
0x06, 0x00, 0x00, 0xF0, 0x0F, 0xF0, 0x0F, 0x00, 0x08, 0xF0, 0x0F, 0xF0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char u
0x05, 0xF0, 0x00, 0xF0, 0x0F, 0x00, 0x08, 0xF0, 0x0F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char v
0x09, 0x70, 0x00, 0xF0, 0x0F, 0x00, 0x0C, 0xF0, 0x0F, 0x70, 0x00, 0xF0, 0x0F, 0x00, 0x0C, 0xF0, 0x0F, 0x70, 0x00, 0x00, 0x00, // Code for char w
0x05, 0x30, 0x0C, 0xF0, 0x0F, 0x00, 0x01, 0xF0, 0x0F, 0x30, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char x
0x06, 0x30, 0x00, 0xF0, 0x11, 0x80, 0x1F, 0x00, 0x1C, 0xF0, 0x0F, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char y
0x05, 0x10, 0x0C, 0x10, 0x0F, 0xD0, 0x0B, 0xF0, 0x08, 0x30, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char z
0x04, 0x80, 0x01, 0xF8, 0x1F, 0x7C, 0x3E, 0x0C, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char {
0x02, 0x00, 0x00, 0xFC, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char |
0x05, 0x00, 0x00, 0x0C, 0x30, 0x7C, 0x3E, 0xF8, 0x1F, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char }
0x07, 0xC0, 0x00, 0x60, 0x00, 0x60, 0x00, 0xE0, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Code for char ~
0x03, 0xFE, 0x07, 0x02, 0x04, 0xFE, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // Code for char
};
char detc[90]={' ','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','!','#','$','%','&','(',')','*','+','-',',','.','/',':',';','<','=','>','?','@','[',']','_','{','}','|','~'};
const unsigned char alpc[90][6] PROGMEM ={
{0,0,0,0,0,0},//space
{126,17,17,17,126,0},//A
{127,73,73,73,54,0},//B
{62,65,65,65,34,0},//C
{127,65,65,34,28,0},//D
{127,73,73,73,65,0},//E
{127,9,9,9,1,0},//F
{62,65,73,73,122,0},//G
{127,8,8,8,127,0},//H
{0,65,127,65,0,0},//I
{32,64,65,63,1,0},//J
{127,8,20,34,65,0},//K
{127,64,64,64,64,0},//L
{127,2,12,2,127,0},//M
{127,4,8,16,127,0},//N
{62,65,65,65,62,0},//O
{127,9,9,9,6,0},//P
{62,65,81,33,94,0},//Q
{127,9,25,41,70,0},//R
{70,73,73,73,49,0},//S
{1,1,127,1,1,0},//T
{63,64,64,64,63,0},//U
{31,32,64,32,31,0},//V
{63,64,56,64,63,0},//W
{99,20,8,20,99,0},//X
{7,8,112,8,7,0},//Y
{97,81,73,69,67,0},//Z
{32,84,84,84,120,0},//a
{127,68,68,68,120,0},//b
{56,68,68,68,68,0},//c
{56,68,68,68,127,0},//d
{56,84,84,84,24,0},//e
{4,4,126,5,5,0},//f
{8,84,84,84,60,0},//g
{127,8,4,4,120,0},//h
{0,68,125,64,0,0},//i
{32,64,68,61,0,0},//j
{127,16,40,68,0,0},//k
{0,65,127,64,0,0},//l
{124,4,120,4,120,0},//m
{124,8,4,4,120,0},//n
{56,68,68,68,56,0},//o
{124,20,20,20,8,0},//p
{8,20,20,20,124,0},//q
{0,124,8,4,4,0},//r
{72,84,84,84,36,0},//s
{4,4,63,68,68,0},//t
{60,64,64,32,124,0},//u
{28,32,64,32,28,0},//v
{60,64,48,64,60,0},//w
{68,40,16,40,68,0},//x
{12,80,80,80,60,0},//y
{68,100,84,76,68,0},//z
{62,81,73,69,62,0},//0
{4,2,127,0,0,0},//1
{66,97,81,73,70,0},//2
{34,65,73,73,54,0},//3
{24,20,18,127,16,0},//4
{39,69,69,69,57,0},//5
{62,73,73,73,50,0},//6
{1,1,113,9,7,0},//7
{54,73,73,73,54,0},//8
{38,73,73,73,62,0},//9
{0,0,95,0,0,0},//!
{20,62,20,62,20,0},//#
{36,42,127,42,18,0},//$
{67,51,8,102,97,0},//%
{54,73,85,34,80,0},//&
{0,28,34,65,0,0},//(
{0,65,34,28,0,0},//)
{20,8,62,8,20,0},//*
{8,8,62,8,8,0},//+
{8,8,8,8,8,0},//-
{0,80,48,0,0,0},//,
{0,96,96,0,0,0},//.
{32,16,8,4,2,0},///
{0,54,54,0,0,0},//:
{0,86,54,0,0,0},//;
{8,20,34,65,0,0},//<
{20,20,20,20,20,0},//=
{0,65,34,20,8,0},//>
{2,1,81,9,6,0},//?
{62,65,89,85,94,0},//@
{0,127,65,0,0,0},//[
{0,0,65,127,0,0},//]
{64,64,64,64,64,0},//_
{0,8,54,65,65,0},//{
{65,65,54,8,0,0},//}
{0,0,127,0,0,0},//|
{2,1,2,4,2,0}//~
};
void uart_send(unsigned char d)
{
while((UCSRA & 0X20)==0)
{
}
UDR=d;
}
unsigned char uart_rec(void)
{
if((UCSRA & 0X80)==0x80)
return UDR;
else
return 0;
}
void init_uart(void)
{
UCSRA |= (1<<U2X);
UCSRB |= (1<<TXEN)|(1<<RXEN);
UBRRL=12;
}
void uart_string(char *data)
{
while(*data)
{
uart_send(*data);
*data++;
}
}
void uart_transmit(int value)
{
char buffer[5]={0};
itoa(value,buffer,10);
uart_string(buffer);
uart_send(32);
}
void twi_init()
{
TWSR=0x00;
TWBR=0x02;
}
unsigned char twi_send_start()
{
TWCR = (1<<TWINT)|(1<<TWSTA)|(1<<TWEN);
while (!(TWCR & (1<<TWINT)))
;
return (TWSR & 0xf8);
while((TWSR & 0xf8) != 0x08)
;
}
unsigned char twi_send_repeated_start(void)
{
TWCR = (1<<TWINT)|(1<<TWSTA)|(1<<TWEN);
while (!(TWCR & (1<<TWINT))) ;
return (TWSR & 0xf8);
while((TWSR & 0xf8) != 0x10)
;
}
unsigned char twi_send_address_rw(unsigned char address_rw)
{
TWDR = address_rw;
TWCR = (1<<TWINT)|(1<<TWEN);
while (!(TWCR & (1<<TWINT)))
;
return (TWSR & 0xf8);
while(((TWSR & 0xf8) != 0x18) || ((TWSR & 0xf8) != 0x40))
;
}
unsigned char twi_master_send_data(unsigned char data)
{
TWDR = data;
TWCR = (1<<TWINT) |(1<<TWEN);
while (!(TWCR & (1<<TWINT)))
;
return (TWSR & 0xf8);
while((TWSR & 0xf8) != 0x28)
;
}
unsigned char twi_master_send_string(unsigned char *string)
{
while (*string)
{
TWDR = *string++;
TWCR = (1<<TWINT) |(1<<TWEN);
while (!(TWCR & (1<<TWINT)))
;
while((TWSR & 0xf8) != 0x28)
;
}
return (TWSR & 0xf8);
}
unsigned char twi_master_receive_data()
{
TWCR =(1<<TWEA)|(1<<TWINT)|(1<<TWEN);
while (!(TWCR & (1<<TWINT)))
;
return(TWDR);
while((TWSR & 0xf8) != 0x50)
;
}
unsigned char twi_master_receive_last_data()
{
TWCR =(1<<TWINT)|(1<<TWEN);
while (!(TWCR & (1<<TWINT)))
;
return(TWDR);
while((TWSR & 0xf8) != 0x58)
;
}
void twi_send_stop()
{
TWCR = (1<<TWINT)|(1<<TWEN)|(1<<TWSTO);
while ((TWCR & (1<<TWSTO)))
;
}
void oled_write_command(unsigned char oledcommand)
{
unsigned char twi_status;
twi_send_start();
twi_status=twi_send_address_rw(0x78);
twi_status=twi_master_send_data(0x80);
twi_status=twi_master_send_data(oledcommand);
twi_send_stop();
}
void oled_write_data(unsigned char oleddata)
{
unsigned char twi_status;
twi_send_start();
twi_status=twi_send_address_rw(0x78);
twi_status=twi_master_send_data(0x40);
twi_status=twi_master_send_data(oleddata);
twi_send_stop();
}
void oled_write_idata(unsigned char oleddata)
{
unsigned char twi_status;
twi_send_start();
twi_status=twi_send_address_rw(0x78);
twi_status=twi_master_send_data(0x40);
twi_status=twi_master_send_data(~oleddata);
twi_send_stop();
}
void oled_goto(uint8_t,uint8_t);
void oled_goto(uint8_t x,uint8_t y)
{
oled_write_command(0xB0|y);
oled_write_command(0x00|(x & 0x0F));
oled_write_command(0x10|((x>>4) & 0x0F));
}
void oled_clrscr()
{
unsigned char clry=0;
unsigned char clrx=0;
for(clry=0;clry<=7;clry++)
{
for(clrx=0;clrx<=127;clrx++)
{
oled_goto(clrx,clry);
oled_write_data(0x00);
}
}
}
void oled_fillscr()
{
unsigned char filly=0;
unsigned char fillx=0;
for(filly=0;filly<=7;filly++)
{
for(fillx=0;fillx<=127;fillx++)
{
oled_goto(fillx,filly);
oled_write_data(0xff);
}
}
}
void oled_printc(char det)
{
int loc=0;
for(ioled=0;ioled<=89;ioled++)
{
if(detc[ioled]==det)
{
loc=ioled;
for(joled=0;joled<=5;joled++)
{
oled_write_data(pgm_read_byte(&(alpc[loc][joled])));
}
break;
}
}
}
void oled_prints(char *data)
{
while(*data)
{
oled_printc(*data);
*data++;
}
}
void oled_printi(int value)
{
char buffer[5]={'0','0','0','0','0'};
itoa(value,buffer,10);
oled_prints(buffer);
}
void oled_image()
{
int line_image=0;
int col_image=0;
for(line_image=0;line_image<=7;line_image++)
{
oled_goto(0,line_image);
for(col_image=0;col_image<=127;col_image++)
{
//oled_write_idata(bitmap[line_image][col_image]);
oled_write_idata(pgm_read_byte(&(bitmap[line_image][col_image])));
}
}
}
void oled_init()
{
oled_write_command(0xA8); //Set MUX ratio
oled_write_command(0x3F); //SET MUX RATIO
oled_write_command(0xD3); //SET DISPLAY OFFSET
oled_write_command(0x00); //SET DISPLAY OFFSET
oled_write_command(0x40); //SET DISPLAY START LINE
oled_write_command(0xA1); //SET SEGMENT RE-MAP
oled_write_command(0xC8); //SET COM OUTPUT SCAN DIRECTION
oled_write_command(0xDA); //SET COM PINS HARDWARE CONFIGURATION
oled_write_command(0x12); //SET COM PINS HARDWARE CONFIGURATION
oled_write_command(0x81); //SET CONTRAST CONTROL
oled_write_command(0x7F); //SET CONTRAST CONTROL
oled_write_command(0xA4); //DISABLE ENTIRE DISPLAY ON
oled_write_command(0xA6); //SET NORMAL DISPLAY
oled_write_command(0xD5); //SET OSCILLATOR FREQUENCY
oled_write_command(0x80); //SET OSCILLATOR FREQUENCY
oled_write_command(0x8D); //ENABLE CHARGE PUMP REGULATOR
oled_write_command(0x14); //ENABLE CHARGE PUMP REGULATOR
oled_write_command(0xAF); //DISPLAY ON
oled_clrscr();
}
void oled_scroll_ver()
{
oled_write_command(0x29); //VERTICAL AND RIGHT HORIZONTAL SCROLL
oled_write_command(0x00); //DUMMY BYTE SET TO 00H
oled_write_command(0x00); //STAR PAGE (000 - 111)
oled_write_command(0x00); //FRAME INTERVAL (00H 5 FRAMES)
oled_write_command(0x07); //END PAGE (000 - 111)
oled_write_command(0x01); //SET VERTICAL OFFSET AS 1 ROW
oled_write_command(0x2F); //ACTIVATE SCROLLING
}
void print_fchar(char ch, unsigned char x_cord, unsigned char y_cord)
{
unsigned char ascii_to_array_index = ch - first_char_ascii_code;
int char_start_in_array = ((ascii_to_array_index * no_of_bytes_char) + 1);
for(unsigned char jff = x_cord; jff < (x_cord + char_columns_required); jff++)
{
for(unsigned char iff = y_cord; iff < (y_cord + char_pages_required); iff++)
{
oled_goto(jff,iff);
int array_index = char_start_in_array + (jff - x_cord) * char_pages_required + (iff - y_cord);
unsigned char char_byte = pgm_read_byte(&font2[array_index]);
oled_write_data(char_byte);
}
}
}
void print_fstring(char *stringf, unsigned char x_cordf, unsigned char y_cordf)
{
while(*stringf)
{
print_fchar(*stringf,x_cordf,y_cordf);
x_cordf = ( x_cordf + char_columns_required);
*stringf++;
}
}
void defcon()
{
print_fstring(" BLOCKCHAIN ",1,0);
print_fstring(" VILLAGE ",6,2);
oled_goto(4,5);
oled_prints(" DEF CON 29 ");
oled_goto(1,6);
oled_prints(" Las Vegas ");
}
void invalid()
{
print_fstring(" INVALID ",5,2);
oled_goto(9,5);
oled_prints(" PLEASE TRY AGAIN ");
}
void vscroll_1()
{
oled_scroll_ver();
oled_scroll_ver();
}
void insert_code()
{
start:
oled_clrscr();
print_fstring(" INSERT CODE",7,0);
oled_goto(0,3);
oled_prints(">>");
oled_goto(15,3);
int code_counter=0;
while(1)
{
if(bit_is_clear(PINA, PA0)) //Binary one "1"
{
oled_printi(1);
while(bit_is_clear(PINA, PA0));
_delay_ms(1000);
store_code[code_counter]=1;
code_counter++;
if(code_counter==8)
{
oled_goto(0,4);
oled_prints(">>");
oled_goto(15,4);
}
else if(code_counter==16)
{
oled_goto(0,5);
oled_prints(">>");
oled_goto(15,5);
}
else if(code_counter==24)
{
oled_goto(0,6);
oled_prints(">>");
oled_goto(15,6);
}
else if(code_counter==32)
{
oled_goto(0,7);
oled_prints(">>");
oled_goto(15,7);
}
}
else if(bit_is_clear(PINA, PA1))//Binary zero "0"
{
oled_printi(0);
while(bit_is_clear(PINA, PA1));
_delay_ms(1000);
store_code[code_counter]=0;
code_counter++;
if(code_counter==8)
{
oled_goto(0,4);
oled_prints(">>");
oled_goto(15,4);
}
else if(code_counter==16)
{
oled_goto(0,5);
oled_prints(">>");
oled_goto(15,5);
}
else if(code_counter==24)
{
oled_goto(0,6);
oled_prints(">>");
oled_goto(15,6);
}
else if(code_counter==32)
{
oled_goto(0,7);
oled_prints(">>");
oled_goto(15,7);
}
}
else if(bit_is_clear(PINA, PA3))//Switch S2
{
goto start;
}
else if(code_counter==40)
{
oled_goto(12,7);
oled_prints("PUZZLE UNAVAILABLE");
password=0;
oled_clrscr();
while(1)
{
if(bit_is_clear(PINA, PA2))//Switch S1
{
while(bit_is_clear(PINA, PA2));
_delay_ms(1000);
goto j1;
}
}
}
}
j1:_delay_ms(1);
}
void WRITE_NAME_HERE()
{
print_fstring("Jim Moriarty",1,2);
oled_goto(5,5);
oled_prints("Did you miss me?");
}
int main()
{
twi_init(); /*TWI initialisaiton*/
oled_init();
DDRA=0b00000000;
oled_write_command(0x2E);
oled_image();
vscroll_1();
for(int one_v_scroll=0;one_v_scroll<=120;one_v_scroll++)
{
_delay_ms(1000);
}
while(1)
{
if(bit_is_clear(PINA, PA2))//Switch S1
{
oled_write_command(0x2E);
insert_code();
}
else
{
oled_write_command(0x2E);
oled_clrscr();
WRITE_NAME_HERE(); // Write your name in this function
for(int one_v_scroll=0;one_v_scroll<=120;one_v_scroll++)
{
_delay_ms(1000);
}
oled_image();
vscroll_1();
for(int one_v_scroll=0;one_v_scroll<=120;one_v_scroll++)
{
_delay_ms(1000);
}
oled_write_command(0x2E);
oled_clrscr();
defcon();
for(int one_v_scroll=0;one_v_scroll<=120;one_v_scroll++)
{
_delay_ms(1000);
}
}
}
}
Comments