Font Size

Olá, caro(a) leitor(a)! Hoje vamos explorar um projeto muito divertido que envolve algumas funcionalidades de um display OLED, como a exibição de caracteres, imagens e animações. Trata-se de um placar eletrônico que contabiliza os pontos de dois jogadores e determina o vencedor, assim que ele alcance uma pontuação pré-definida. Além disso quando a partida chegar ao fim, o placar irá exibir uma animação e tocar uma música para o vencedor.

Pronto(a) para começar ?

Imagem do circuito do placar com Display OLED

     Imagem 1 – Foto do circuito

 

Esquemático do circuito no software Tinkercad, junto com uma imagem do Display OLED

Imagem 2 – Esquemático do Circuito

 

Materiais Utilizados:

 

Agora vamos por partes…

Display OLED 128×64:

Para exibir os pontos, utilizamos um dos displays disponíveis aqui na loja, trata-se de uma pequena tela OLED de 128 por 64 pixels baseada no sistema de comunicação I2C, que permite a interação com o controlador utilizando apenas 2 pinos! O Serial Clock (SCL) e o Serial Data (SDA). Portanto iremos conectar esses pinos da seguinte forma:

Imagem do Display OLED, exibindo as conexões dele com o Arduino

Imagem 3 – Conexões do Display

 

As portas A4 e A5, por padrão, são responsáveis pela comunicação I2C no Arduino Nano, portanto, não é necessário declará-las no código. Porém, lembre-se que as portas específicas para SCL e SDA podem variar conforme o microcontrolador, então sempre verifique na internet se estiver usando outro modelo.

Mas como formar os números e desenhos no display ?

Com a ajuda das bibliotecas Adafruit GFX e Adafruit SSD1306, disponíveis no Arduino IDE, é possível exibir textos e formas geométricas pré-definidas, como retângulos, círculos e retas, de maneira simples. Também podemos exibir imagens usando bitmaps, que são matrizes descrevendo cada um dos pixels. Neste projeto, utilizamos a exibição de texto para mostrar as pontuações, e a de imagens, para apresentar uma animação simples.

 

Imagem do Buzzer

Imagem 4 – Conexões do Buzzer

 

Conecte o lado positivo do Buzzer Passivo (marcado com um símbolo de +) à porta D4 do Arduino e o outro lado ao GND. As ligações são simples.. Inserir um resistor ou potenciômetro pode reduzir o volume e ajudar a preservar o Buzzer, mas, no nosso caso, isso não é necessário.

Botões

Os botões irão servir para acrescentar pontos às equipes, e também para reiniciar o jogo quando ele chegar ao fim. Conforme o Esquemático do Circuito (Imagem 3), você deve ligar cada um dos botões a uma porta digital do Arduino e ao GND. O botão conectado ao pino D8 corresponde ao Player 1, número à esquerda no placar, já o outro botão, ligado ao pino D7, corresponde ao Player 2. Ao fim do jogo, após o término da música, basta pressionar qualquer um dos botões para zerar as pontuações e reiniciar tudo!

Declaramos as portas D7 e D8 como Input Pull-up, opção que verifica se há conexão entre a porta e o GND. Portanto, quando alguém pressiona o botão, a conexão é estabelecida e o pino retorna um sinal digital LOW. Ao declarar o pino dessa forma, habilitamos o Resistor Pull-up interno do Arduino; portanto, não é necessário adicionar resistores diretamente aos botões (apesar de termos utilizado na nossa montagem).

Quando o sistema detectar que algum dos botões foi pressionado, ele acrescentará 1 ponto no placar, para o jogador correspondente.

Já conectou tudo ?

Agora utilize o Arduino IDE para fazer o upload do seguinte código no Arduino.


#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

//Define a pontuação necessária para uma das equipes vencer
int valorpravencer = 3;

// Inicia placar
int placarplayer1 = 0;
int placarplayer2 = 0;

//Definindo e iniciando o Display OLED
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

//Definindo o Buzzer
int buzzerPin = 4; // Pino digital conectado ao buzzer
bool musicatocou = false;

//Função para tocar nota definida
void tocarNota(int frequencia, int duracao) {
  tone(buzzerPin, frequencia); // Toca a nota com a frequência especificada
  delay(duracao);              // Duração da nota
}

//BITMAPS
// '0'
const unsigned char epd_bitmap_0 [] PROGMEM = {
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x0f, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x01, 0x86, 0x0d, 0xc0, 0x00, 0x00, 0x00, 
    0x00, 0x0f, 0xe3, 0x80, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x81, 0x87, 0x1d, 0xc0, 0x00, 0x00, 0x00, 
    0x00, 0x0f, 0xf3, 0x80, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x81, 0x8f, 0x1c, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x0e, 0x73, 0x8f, 0x9c, 0x31, 0xe1, 0xb8, 0x01, 0xc1, 0xcf, 0x19, 0xcd, 0xe1, 0xf0, 0x00, 
    0x00, 0x0e, 0x73, 0x9f, 0xcc, 0x73, 0xf1, 0xf8, 0x01, 0xc1, 0xcf, 0x99, 0xcf, 0xf3, 0xf0, 0x00, 
    0x00, 0x0e, 0x73, 0x81, 0xce, 0x77, 0x39, 0xe0, 0x03, 0x80, 0xcd, 0xb9, 0xce, 0x73, 0x80, 0x00, 
    0x00, 0x0f, 0xe3, 0x83, 0xce, 0x67, 0x39, 0xc0, 0x03, 0x00, 0xdd, 0xb9, 0xce, 0x33, 0xc0, 0x00, 
    0x00, 0x0f, 0xc3, 0x9f, 0xc6, 0xe7, 0xf9, 0xc0, 0x07, 0x00, 0xf9, 0xb1, 0xce, 0x31, 0xf0, 0x00, 
    0x00, 0x0e, 0x03, 0xb8, 0xc7, 0xe7, 0x01, 0xc0, 0x0c, 0x00, 0xf9, 0xf1, 0xce, 0x30, 0x78, 0x00, 
    0x00, 0x0e, 0x03, 0xb9, 0xc3, 0xc7, 0x01, 0xc0, 0x18, 0x00, 0x78, 0xf1, 0xce, 0x30, 0x38, 0x00, 
    0x00, 0x0e, 0x03, 0xbf, 0xc3, 0xc3, 0xf9, 0xc0, 0x3f, 0xc0, 0x78, 0xf1, 0xce, 0x33, 0xf8, 0x00, 
    0x00, 0x0e, 0x03, 0x9e, 0xc3, 0x81, 0xf9, 0xc0, 0x3f, 0xc0, 0x70, 0xe1, 0xce, 0x33, 0xf0, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 
    0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 
    0x00, 0x00, 0x80, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 
    0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x80, 
    0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xfe, 0x00, 0x00, 0x00, 0x64, 0x00, 0x10, 0x00, 
    0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x07, 0xfc, 0x3f, 0xe0, 0x00, 0x00, 0x04, 0x00, 0x10, 0x00, 
    0x00, 0x88, 0x00, 0x20, 0x00, 0x00, 0x3f, 0x00, 0x01, 0xfc, 0x00, 0x00, 0x00, 0x04, 0x00, 0x10, 
    0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x61, 0x03, 0xc0, 0x86, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0xff, 0xff, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 
    0x00, 0x00, 0x80, 0x00, 0x00, 0x01, 0x80, 0xff, 0xfe, 0x01, 0x80, 0x00, 0x10, 0x00, 0x11, 0x00, 
    0x00, 0x44, 0x00, 0x00, 0x00, 0x01, 0x07, 0xfc, 0x3f, 0xe1, 0x80, 0x00, 0x00, 0x02, 0x00, 0x00, 
    0x00, 0x20, 0x04, 0x02, 0x00, 0x01, 0x1c, 0x00, 0x00, 0x38, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x30, 0x00, 0x00, 0x0c, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x30, 0x00, 0x00, 0x0c, 0xc0, 0x00, 0x00, 0x10, 0x00, 0x20, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x20, 0x10, 0x08, 0x0c, 0xf0, 0x00, 0x00, 0x08, 0x30, 0x00, 
    0x00, 0x00, 0x20, 0x40, 0x40, 0x1b, 0x20, 0x38, 0x1c, 0x04, 0x90, 0x00, 0x00, 0x08, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x40, 0x00, 0x1b, 0x20, 0x38, 0x1c, 0x04, 0x90, 0x00, 0x10, 0x00, 0x00, 0x00, 
    0x00, 0x20, 0x00, 0x00, 0x06, 0x1b, 0x20, 0x00, 0x00, 0x04, 0x90, 0x40, 0x10, 0x00, 0x00, 0x00, 
    0x00, 0x20, 0x00, 0x00, 0x0f, 0x1b, 0x20, 0x00, 0x00, 0x04, 0x90, 0xf0, 0x20, 0x00, 0x00, 0x00, 
    0x00, 0x40, 0x00, 0x00, 0x3b, 0x1b, 0x61, 0x00, 0x00, 0x84, 0x91, 0x9c, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x80, 0x00, 0x00, 0x7f, 0xb9, 0x21, 0xc0, 0x01, 0x84, 0x9d, 0x7c, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x4f, 0xfd, 0x20, 0xf8, 0x1f, 0x05, 0xbf, 0xf6, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x7f, 0xef, 0xa0, 0x3f, 0xfe, 0x05, 0xb7, 0xde, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0xf6, 0x3f, 0xb0, 0x07, 0xf0, 0x0d, 0xec, 0x7f, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0xbc, 0x1c, 0x98, 0x00, 0x00, 0x19, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0xe8, 0x3c, 0x8e, 0x00, 0x00, 0x73, 0x3c, 0x37, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x78, 0x67, 0xc3, 0xe0, 0x07, 0xc3, 0xc6, 0x1e, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x18, 0x41, 0xe0, 0xff, 0xff, 0x07, 0x82, 0x38, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x0e, 0xc0, 0x7c, 0x03, 0xc0, 0x3e, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x6f, 0xc0, 0x03, 0xf6, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x69, 0xff, 0xff, 0x92, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00
};
// '1'
const unsigned char epd_bitmap_1 [] PROGMEM = {
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x0f, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x01, 0x86, 0x0d, 0xc0, 0x00, 0x00, 0x00, 
    0x00, 0x0f, 0xe3, 0x80, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x81, 0x87, 0x1d, 0xc0, 0x00, 0x00, 0x00, 
    0x00, 0x0f, 0xf3, 0x80, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x81, 0x8f, 0x1c, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x0e, 0x73, 0x8f, 0x9c, 0x31, 0xe1, 0xb8, 0x01, 0xc1, 0xcf, 0x19, 0xcd, 0xe1, 0xf0, 0x00, 
    0x00, 0x0e, 0x73, 0x9f, 0xcc, 0x73, 0xf1, 0xf8, 0x01, 0xc1, 0xcf, 0x99, 0xcf, 0xf3, 0xf0, 0x00, 
    0x00, 0x0e, 0x73, 0x81, 0xce, 0x77, 0x39, 0xe0, 0x03, 0x80, 0xcd, 0xb9, 0xce, 0x73, 0x80, 0x00, 
    0x00, 0x0f, 0xe3, 0x83, 0xce, 0x67, 0x39, 0xc0, 0x03, 0x00, 0xdd, 0xb9, 0xce, 0x33, 0xc0, 0x00, 
    0x00, 0x0f, 0xc3, 0x9f, 0xc6, 0xe7, 0xf9, 0xc0, 0x07, 0x00, 0xf9, 0xb1, 0xce, 0x31, 0xf0, 0x00, 
    0x00, 0x0e, 0x03, 0xb8, 0xc7, 0xe7, 0x01, 0xc0, 0x0c, 0x00, 0xf9, 0xf1, 0xce, 0x30, 0x78, 0x00, 
    0x00, 0x0e, 0x03, 0xb9, 0xc3, 0xc7, 0x01, 0xc0, 0x18, 0x00, 0x78, 0xf1, 0xce, 0x30, 0x38, 0x00, 
    0x00, 0x0e, 0x03, 0xbf, 0xc3, 0xc3, 0xf9, 0xc0, 0x3f, 0xc0, 0x78, 0xf1, 0xce, 0x33, 0xf8, 0x00, 
    0x00, 0x0e, 0x03, 0x9e, 0xc3, 0x81, 0xf9, 0xc0, 0x3f, 0xc0, 0x70, 0xe1, 0xce, 0x33, 0xf0, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xfc, 0x3f, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x01, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x03, 0xc0, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0xff, 0xff, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0xff, 0xfe, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0xfc, 0x3f, 0xe1, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1c, 0x00, 0x00, 0x38, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x30, 0x00, 0x00, 0x0c, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x30, 0x00, 0x00, 0x0c, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x20, 0x10, 0x08, 0x0c, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x20, 0x38, 0x1c, 0x04, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x20, 0x38, 0x1c, 0x04, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x06, 0x1b, 0x20, 0x00, 0x00, 0x04, 0x90, 0x40, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x0f, 0x1b, 0x20, 0x00, 0x00, 0x04, 0x90, 0xf0, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x3b, 0x1b, 0x61, 0x00, 0x00, 0x84, 0x91, 0x9c, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x7f, 0xb9, 0x21, 0xc0, 0x01, 0x84, 0x9d, 0x7c, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x4f, 0xfd, 0x20, 0xf8, 0x1f, 0x05, 0xbf, 0xf6, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x7f, 0xef, 0xa0, 0x3f, 0xfe, 0x05, 0xb7, 0xde, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0xf6, 0x3f, 0xb0, 0x07, 0xf0, 0x0d, 0xec, 0x7f, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0xbc, 0x1c, 0x98, 0x00, 0x00, 0x19, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0xe8, 0x3c, 0x8e, 0x00, 0x00, 0x73, 0x3c, 0x37, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x78, 0x67, 0xc3, 0xe0, 0x07, 0xc3, 0xc6, 0x1e, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x18, 0x41, 0xe0, 0xff, 0xff, 0x07, 0x82, 0x38, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x0e, 0xc0, 0x7c, 0x03, 0xc0, 0x3e, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x6f, 0xc0, 0x03, 0xf6, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x69, 0xff, 0xff, 0x92, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00
};
// '2'
const unsigned char epd_bitmap_2 [] PROGMEM = {
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x0f, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x02, 0x01, 0x86, 0x0d, 0xc0, 0x00, 0x00, 0x00, 
    0x00, 0x0f, 0xe3, 0x80, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0x87, 0x1d, 0xc0, 0x00, 0x00, 0x00, 
    0x00, 0x0f, 0xf3, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x01, 0x8f, 0x1c, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x0e, 0x73, 0x8f, 0x9c, 0x31, 0xe1, 0xb8, 0x3f, 0x01, 0xcf, 0x19, 0xcd, 0xe1, 0xf0, 0x00, 
    0x00, 0x0e, 0x73, 0x9f, 0xcc, 0x73, 0xf1, 0xf8, 0x17, 0x01, 0xcf, 0x99, 0xcf, 0xf3, 0xf0, 0x00, 
    0x00, 0x0e, 0x73, 0x81, 0xce, 0x77, 0x39, 0xe0, 0x07, 0x00, 0xcd, 0xb9, 0xce, 0x73, 0x80, 0x00, 
    0x00, 0x0f, 0xe3, 0x83, 0xce, 0x67, 0x39, 0xc0, 0x07, 0x00, 0xdd, 0xb9, 0xce, 0x33, 0xc0, 0x00, 
    0x00, 0x0f, 0xc3, 0x9f, 0xc6, 0xe7, 0xf9, 0xc0, 0x07, 0x00, 0xf9, 0xb1, 0xce, 0x31, 0xf0, 0x00, 
    0x00, 0x0e, 0x03, 0xb8, 0xc7, 0xe7, 0x01, 0xc0, 0x07, 0x00, 0xf9, 0xf1, 0xce, 0x30, 0x78, 0x00, 
    0x00, 0x0e, 0x03, 0xb9, 0xc3, 0xc7, 0x01, 0xc0, 0x07, 0x00, 0x78, 0xf1, 0xce, 0x30, 0x38, 0x00, 
    0x00, 0x0e, 0x03, 0xbf, 0xc3, 0xc3, 0xf9, 0xc0, 0x07, 0x00, 0x78, 0xf1, 0xce, 0x33, 0xf8, 0x00, 
    0x00, 0x0e, 0x03, 0x9e, 0xc3, 0x81, 0xf9, 0xc0, 0x07, 0x00, 0x70, 0xe1, 0xce, 0x33, 0xf0, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 
    0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 
    0x00, 0x00, 0x80, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 
    0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x80, 
    0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xfe, 0x00, 0x00, 0x00, 0x64, 0x00, 0x10, 0x00, 
    0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x07, 0xfc, 0x3f, 0xe0, 0x00, 0x00, 0x04, 0x00, 0x10, 0x00, 
    0x00, 0x88, 0x00, 0x20, 0x00, 0x00, 0x3f, 0x00, 0x01, 0xfc, 0x00, 0x00, 0x00, 0x04, 0x00, 0x10, 
    0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x61, 0x03, 0xc0, 0x86, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0xff, 0xff, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 
    0x00, 0x00, 0x80, 0x00, 0x00, 0x01, 0x80, 0xff, 0xfe, 0x01, 0x80, 0x00, 0x10, 0x00, 0x11, 0x00, 
    0x00, 0x44, 0x00, 0x00, 0x00, 0x01, 0x07, 0xfc, 0x3f, 0xe1, 0x80, 0x00, 0x00, 0x02, 0x00, 0x00, 
    0x00, 0x20, 0x04, 0x02, 0x00, 0x01, 0x1c, 0x00, 0x00, 0x38, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x30, 0x00, 0x00, 0x0c, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x30, 0x00, 0x00, 0x0c, 0xc0, 0x00, 0x00, 0x10, 0x00, 0x20, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x20, 0x10, 0x08, 0x0c, 0xf0, 0x00, 0x00, 0x08, 0x30, 0x00, 
    0x00, 0x00, 0x20, 0x40, 0x40, 0x1b, 0x20, 0x38, 0x1c, 0x04, 0x90, 0x00, 0x00, 0x08, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x40, 0x00, 0x1b, 0x20, 0x38, 0x1c, 0x04, 0x90, 0x00, 0x10, 0x00, 0x00, 0x00, 
    0x00, 0x20, 0x00, 0x00, 0x06, 0x1b, 0x20, 0x00, 0x00, 0x04, 0x90, 0x40, 0x10, 0x00, 0x00, 0x00, 
    0x00, 0x20, 0x00, 0x00, 0x0f, 0x1b, 0x20, 0x00, 0x00, 0x04, 0x90, 0xf0, 0x20, 0x00, 0x00, 0x00, 
    0x00, 0x40, 0x00, 0x00, 0x3b, 0x1b, 0x61, 0x00, 0x00, 0x84, 0x91, 0x9c, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x80, 0x00, 0x00, 0x7f, 0xb9, 0x21, 0xc0, 0x01, 0x84, 0x9d, 0x7c, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x4f, 0xfd, 0x20, 0xf8, 0x1f, 0x05, 0xbf, 0xf6, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x7f, 0xef, 0xa0, 0x3f, 0xfe, 0x05, 0xb7, 0xde, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0xf6, 0x3f, 0xb0, 0x07, 0xf0, 0x0d, 0xec, 0x7f, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0xbc, 0x1c, 0x98, 0x00, 0x00, 0x19, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0xe8, 0x3c, 0x8e, 0x00, 0x00, 0x73, 0x3c, 0x37, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x78, 0x67, 0xc3, 0xe0, 0x07, 0xc3, 0xc6, 0x1e, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x18, 0x41, 0xe0, 0xff, 0xff, 0x07, 0x82, 0x38, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x0e, 0xc0, 0x7c, 0x03, 0xc0, 0x3e, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x6f, 0xc0, 0x03, 0xf6, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x69, 0xff, 0xff, 0x92, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00
};
// '3'
const unsigned char epd_bitmap_3 [] PROGMEM = {
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x0f, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x02, 0x01, 0x86, 0x0d, 0xc0, 0x00, 0x00, 0x00, 
    0x00, 0x0f, 0xe3, 0x80, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0x87, 0x1d, 0xc0, 0x00, 0x00, 0x00, 
    0x00, 0x0f, 0xf3, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x01, 0x8f, 0x1c, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x0e, 0x73, 0x8f, 0x9c, 0x31, 0xe1, 0xb8, 0x3f, 0x01, 0xcf, 0x19, 0xcd, 0xe1, 0xf0, 0x00, 
    0x00, 0x0e, 0x73, 0x9f, 0xcc, 0x73, 0xf1, 0xf8, 0x17, 0x01, 0xcf, 0x99, 0xcf, 0xf3, 0xf0, 0x00, 
    0x00, 0x0e, 0x73, 0x81, 0xce, 0x77, 0x39, 0xe0, 0x07, 0x00, 0xcd, 0xb9, 0xce, 0x73, 0x80, 0x00, 
    0x00, 0x0f, 0xe3, 0x83, 0xce, 0x67, 0x39, 0xc0, 0x07, 0x00, 0xdd, 0xb9, 0xce, 0x33, 0xc0, 0x00, 
    0x00, 0x0f, 0xc3, 0x9f, 0xc6, 0xe7, 0xf9, 0xc0, 0x07, 0x00, 0xf9, 0xb1, 0xce, 0x31, 0xf0, 0x00, 
    0x00, 0x0e, 0x03, 0xb8, 0xc7, 0xe7, 0x01, 0xc0, 0x07, 0x00, 0xf9, 0xf1, 0xce, 0x30, 0x78, 0x00, 
    0x00, 0x0e, 0x03, 0xb9, 0xc3, 0xc7, 0x01, 0xc0, 0x07, 0x00, 0x78, 0xf1, 0xce, 0x30, 0x38, 0x00, 
    0x00, 0x0e, 0x03, 0xbf, 0xc3, 0xc3, 0xf9, 0xc0, 0x07, 0x00, 0x78, 0xf1, 0xce, 0x33, 0xf8, 0x00, 
    0x00, 0x0e, 0x03, 0x9e, 0xc3, 0x81, 0xf9, 0xc0, 0x07, 0x00, 0x70, 0xe1, 0xce, 0x33, 0xf0, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xfc, 0x3f, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x01, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x03, 0xc0, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0xff, 0xff, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0xff, 0xfe, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0xfc, 0x3f, 0xe1, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1c, 0x00, 0x00, 0x38, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x30, 0x00, 0x00, 0x0c, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x30, 0x00, 0x00, 0x0c, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x20, 0x10, 0x08, 0x0c, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x20, 0x38, 0x1c, 0x04, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x20, 0x38, 0x1c, 0x04, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x06, 0x1b, 0x20, 0x00, 0x00, 0x04, 0x90, 0x40, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x0f, 0x1b, 0x20, 0x00, 0x00, 0x04, 0x90, 0xf0, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x3b, 0x1b, 0x61, 0x00, 0x00, 0x84, 0x91, 0x9c, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x7f, 0xb9, 0x21, 0xc0, 0x01, 0x84, 0x9d, 0x7c, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x4f, 0xfd, 0x20, 0xf8, 0x1f, 0x05, 0xbf, 0xf6, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x7f, 0xef, 0xa0, 0x3f, 0xfe, 0x05, 0xb7, 0xde, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0xf6, 0x3f, 0xb0, 0x07, 0xf0, 0x0d, 0xec, 0x7f, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0xbc, 0x1c, 0x98, 0x00, 0x00, 0x19, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0xe8, 0x3c, 0x8e, 0x00, 0x00, 0x73, 0x3c, 0x37, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x78, 0x67, 0xc3, 0xe0, 0x07, 0xc3, 0xc6, 0x1e, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x18, 0x41, 0xe0, 0xff, 0xff, 0x07, 0x82, 0x38, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x0e, 0xc0, 0x7c, 0x03, 0xc0, 0x3e, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x6f, 0xc0, 0x03, 0xf6, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x69, 0xff, 0xff, 0x92, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00
};

//Lista dos bitmaps para facilitar sua exibição
const int epd_bitmap_allArray_LEN = 4;
const unsigned char* epd_bitmap_allArray[4] = {
    epd_bitmap_0,
    epd_bitmap_1,
    epd_bitmap_2,
    epd_bitmap_3
};
// Função para mostrar as imagens
void drawBitmap(int index) {
  display.clearDisplay(); // Limpa o buffer do display
  display.drawBitmap(0, 0, epd_bitmap_allArray[index], SCREEN_WIDTH, SCREEN_HEIGHT, WHITE); // Desenha o bitmap
  display.display(); // Atualiza a tela
}

// Define os pinos dos botões
int botaoplayer2 = 7;   // Botão para incrementar o placar do jogador 2
int botaoplayer1 = 8; // Botão para incrementar o placar do jogador 1

// Função para mostrar o placar
void showTextAnimation() {
  display.clearDisplay();
  display.setTextSize(7); // Ajuste o tamanho da fonte conforme necessário
  display.setTextColor(SSD1306_WHITE); // Cor do texto

  String texto = String(placarplayer1) + "x" + String(placarplayer2);
 
  // Ajuste da posição vertical para centralizar corretamente
  int y = 10; // POSIÇÃO DO EIXO EM Y
  int x = 0; //POSIÇÃO DO EIXO EM X
  
  display.clearDisplay();
  display.setCursor(x, y); // Mantém a posição vertical fixa
  display.println(texto);
  display.display();  
  delay(200); // Ajuste o atraso para controlar a velocidade da animação
}

// Variáveis para controlar o estado do jogo
bool jogoAtivo = true;  // Indica se o jogo está ativo ou não
bool player2Venceu = false;
bool player1Venceu = false;

// Função para reiniciar o jogo
void reiniciarJogo() {
  placarplayer1 = 0;
  placarplayer2 = 0;
  player2Venceu = false;
  player1Venceu = false;
  musicatocou = false;
  jogoAtivo = true;

}

void setup() {
  // Inicia a comunicação serial
  Serial.begin(9600);
  
  // Inicia o display com a alimentação correta.
  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {  // Endereço I2C 0x3C
    Serial.println(F("SSD1306 allocation failed"));
    for (;;); // Não continua se falhar a alocação
  }
  display.clearDisplay(); // Limpa o buffer do display

  // Configura os pinos dos botões como entradas
  pinMode(botaoplayer2, INPUT_PULLUP);
  pinMode(botaoplayer1, INPUT_PULLUP);
}

void loop() {
  if (jogoAtivo) {
    // Verifica se o botão 2 foi pressionado
    if (digitalRead(botaoplayer2) == LOW) {
      delay(200);  // Debounce simples
      if (placarplayer1 < valorpravencer) {
        placarplayer1++;  // Incrementa o placar do player 1
      }
    }

    // Verifica se o botão 1 foi pressionado
    if (digitalRead(botaoplayer1) == LOW) {
      delay(200);  // Debounce simples
      if (placarplayer2 < valorpravencer) {
        placarplayer2++;  // Incrementa o placar do player 2
      }
    }

    // Verifica se algum dos players chegou ao valor para vencer
    if (placarplayer1 == valorpravencer) {
      player2Venceu = true;
      player1Venceu = false;
      jogoAtivo = false;
      musicatocou = true;
    }

    if (placarplayer2 == valorpravencer) {
      player1Venceu = true;
      player2Venceu = false;
      jogoAtivo = false;
      musicatocou = true;
    }

  } else {
    // Se o jogo não está ativo mostra a animação do vencedor
    if (player2Venceu) {
      if(musicatocou == true){
        drawBitmap(3);
        tocarNota(196, 150);
        tocarNota(262, 150);
        drawBitmap(2);
        tocarNota(330, 150);
        tocarNota(392, 150);
        drawBitmap(3);
        tocarNota(524, 150);
        tocarNota(659, 150);
        drawBitmap(2);
        tocarNota(784, 450);
        drawBitmap(3);
        tocarNota(659, 450);
        drawBitmap(2);
        tocarNota(208, 150);
        tocarNota(262, 150);
        drawBitmap(3); 
        tocarNota(311, 150); 
        tocarNota(416, 150);
        drawBitmap(2); 
        tocarNota(524, 150);
        tocarNota(622, 150);
        drawBitmap(3);
        tocarNota(830, 450);
        drawBitmap(2);
        tocarNota(622, 450);
        drawBitmap(3);
        tocarNota(233, 150);
        tocarNota(294, 150);
        drawBitmap(2);
        tocarNota(349, 150);
        tocarNota(466, 150);
        drawBitmap(3);
        tocarNota(587, 150);
        tocarNota(698, 150);
        drawBitmap(2);
        tocarNota(932, 450);
        drawBitmap(3);
        tocarNota(932, 150);
        tocarNota(932, 150);
        drawBitmap(2);
        tocarNota(932, 150);
        drawBitmap(3);
        tocarNota(1046, 900);
        noTone(buzzerPin);
        musicatocou = false;
      }
      else {
        drawBitmap(3);
        delay(300);
        drawBitmap(2);
        delay(300);
      }


    }

    if (player1Venceu) { 
  if(musicatocou == true){
    drawBitmap(1);
    tocarNota(196, 150);
    tocarNota(262, 150);
    drawBitmap(0);
    tocarNota(330, 150);
    tocarNota(392, 150);
    drawBitmap(1);
    tocarNota(524, 150);
    tocarNota(659, 150);
    drawBitmap(0);
    tocarNota(784, 450);
    drawBitmap(1);
    tocarNota(659, 450);
    drawBitmap(0);
    tocarNota(208, 150);
    tocarNota(262, 150);
    drawBitmap(1); 
    tocarNota(311, 150); 
    tocarNota(416, 150);
    drawBitmap(0); 
    tocarNota(524, 150);
    tocarNota(622, 150);
    drawBitmap(1);
    tocarNota(830, 450);
    drawBitmap(0);
    tocarNota(622, 450);
    drawBitmap(1);
    tocarNota(233, 150);
    tocarNota(294, 150);
    drawBitmap(0);
    tocarNota(349, 150);
    tocarNota(466, 150);
    drawBitmap(1);
    tocarNota(587, 150);
    tocarNota(698, 150);
    drawBitmap(0);
    tocarNota(932, 450);
    drawBitmap(1);
    tocarNota(932, 150);
    tocarNota(932, 150);
    drawBitmap(0);
    tocarNota(932, 150);
    drawBitmap(1);
    tocarNota(1046, 900);
    noTone(buzzerPin);
    musicatocou = false;
  }
  else {
    drawBitmap(1);
    delay(300);
    drawBitmap(0);
    delay(300);
  }
}

    // Verificar se qualquer botão foi pressionado para reiniciar o jogo
    if (digitalRead(botaoplayer2) == LOW || digitalRead(botaoplayer1) == LOW) {
      delay(200);  // Debounce simples
      reiniciarJogo();  // Reinicia o jogo
    }
  }
  
  showTextAnimation();
  
  // Imprime o placar no monitor serial a cada loop
  Serial.print("Player 1");
  Serial.print(placarplayer1);
  Serial.print(" | Player 2: ");
  Serial.println(placarplayer2);

  delay(500);  // Espera de meio segundo antes de repetir o loop
}

 

Após o upload do código, o sistema já estará funcionando da forma planejada, assim como no vídeo abaixo. Logo em sequência iremos detalhar um pouco do funcionamento e especificações, pra que você possa entender melhor e alterar parâmetros livremente.

 

Configuração do jogo

Você pode personalizar várias características do funcionamento do placar, e algumas delas são:

Número de pontos até a vitória

Logo no início do código, a variável ‘valorpravencer’ define a pontuação que um dos times deve alcançar para finalizar o jogo. Por padrão, ela está definida como 3.

Animação

Você também pode modificar a animação de vitória, inserindo as suas próprias imagens. No site Image2cpp  você pode inserir imagens e obter seus bitmaps, além disso, controlar um pouco de como sua imagem será representada, como no campo “Brightness”, responsável por decidir o limiar de binarização. Realize esse ajuste até a imagem ficar o mais visível possível.

Demonstração de como alterar o limiar de binzarização da imagem, para melhor visualização no placar

 

 

Imagem 5 – Alterando o Limiar

 

Após  inserir e tratar suas imagens, você pode gerar o bitmap no final da página, copiar tudo e colar no código, fazendo as devidas alterações.

Atenção!

a imagem precisa estar no formato do display para ocupar o tamanho correto na tela, use editores de imagem para deixar as suas com o formato 128×64 pixels.

 

Música tocada

Com o Buzzer Passivo e a função ‘tocarNota();’, você pode modificar a música da forma que preferir, pois basta alterar os dois parâmetros da função, o primeiro é a frequência desejada, em Hertz, e o segundo, trata da duração da nota. Nós intercalamos as notas com as imagens da animação para que elas sejam exibidas simultaneamente.



0.00 avg. rating (0% score) - 0 votes