Go Down

Topic: Array of bitmaps and texts (Read 214 times) previous topic - next topic

Buura

Apr 17, 2019, 10:00 am Last Edit: Apr 17, 2019, 10:04 am by Buura
Hello there,


At my project i am going to print bitmaps and texts on my OLED 0,96 screens day by day. Every day new bitmaps and text will appear on the screens. I created a function that takes an array of bitmaps and array of texts and i am going to loop them day by day. But there is a problem with array of bitmaps. If i use a single variable (summer), my code works and image appears but when i use array of bitmaps, i see a broken image.

Green code works but i failed writing an array of bitmaps code (red code).

One more thing, if you can help me with it i would appreciate it more, i first tried to create an array of bitmap and text together by using "struct". But i failed with it too.

Can you please help me creating an array with 1 bitmap + 2 string or can you please help me adapting an array of bitmaps so i can change the code below and it works.

Code: [Select]

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

#define MUX_Address 0x70        // TCA9548A Encoders address
#define DS3231_I2C_ADDRESS 0x68 // DS3231 address
#define SCREEN_WIDTH 128        // OLED display width, in pixels
#define SCREEN_HEIGHT 64        // OLED display height, in pixels
#define OLED_RESET     4        // Reset pin # (or -1 if sharing Arduino reset pin)

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

const unsigned char summer[] PROGMEM =
{
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x03, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xFF, 0xF0, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFE, 0x00,
  0x00, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xC0,
  0x00, 0x00, 0x00, 0x0F, 0xFF, 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 0x07, 0xE0, 0x03, 0xC0, 0x00, 0x00,
  0x3E, 0x00, 0x0F, 0x80, 0x03, 0xC0, 0x00, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x07, 0x80, 0x00, 0x00,
  0x0F, 0x00, 0x0E, 0x00, 0x07, 0x80, 0x00, 0x00, 0x0F, 0x00, 0x1F, 0x00, 0x07, 0x80, 0x00, 0x00,
  0x1F, 0x80, 0x3F, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x3F, 0xE0, 0x7F, 0x80, 0x0F, 0x00, 0x00, 0x00,
  0x01, 0xFF, 0xF0, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xF0, 0x00, 0x1E, 0x00, 0x00, 0x00,
  0x01, 0xFF, 0xF0, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x01, 0xCF, 0x30, 0x00, 0x3C, 0x00, 0x00, 0x00,
  0x01, 0x0E, 0x18, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00,
  0x00, 0x04, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x1F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xE0, 0x00, 0x00,
  0x00, 0x00, 0x7F, 0xFF, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00,
  0x00, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0x00,
  0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x03, 0xFF, 0x00, 0x3F, 0xFC, 0x01, 0xFF, 0xC0,
  0x01, 0xFC, 0x00, 0x0F, 0xF0, 0x00, 0x3F, 0x80, 0x00, 0xF8, 0x00, 0x03, 0xC0, 0x00, 0x1E, 0x00,
  0x80, 0x00, 0x0C, 0x00, 0x00, 0x70, 0x00, 0x03, 0xF8, 0x00, 0x7F, 0xC0, 0x03, 0xFE, 0x00, 0x1F,
  0xFC, 0x01, 0xFF, 0xE0, 0x0F, 0xFF, 0x80, 0x3F, 0xFF, 0x03, 0xFF, 0xF8, 0x1F, 0xFF, 0xC0, 0xFF,
  0x3F, 0xFF, 0xE1, 0xFF, 0xFF, 0x87, 0xFF, 0xFC, 0x0F, 0xFF, 0x80, 0x7F, 0xFE, 0x01, 0xFF, 0xF0,
  0x07, 0xFF, 0x00, 0x1F, 0xF8, 0x00, 0xFF, 0xC0, 0x01, 0xFC, 0x00, 0x07, 0xE0, 0x00, 0x3F, 0x00
};

const unsigned char very_funny[] 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, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x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0xFF, 0xC0, 0xF8, 0x07, 0xFF, 0xFF, 0x87, 0x9F, 0xFF, 0xF8, 0xF8,
  0x03, 0xFF, 0xFE, 0x0F, 0x9F, 0xFF, 0xFF, 0xF0, 0x03, 0xF3, 0xF0, 0x1F, 0x87, 0xFF, 0xFF, 0xE0,
  0x01, 0xF8, 0x00, 0x3F, 0x01, 0xFF, 0xFF, 0xE0, 0x00, 0xFC, 0x00, 0xFF, 0x00, 0x7F, 0xFF, 0xC0,
  0x00, 0x7F, 0x8F, 0xFE, 0x78, 0x1F, 0xFF, 0x80, 0x00, 0x3F, 0xFF, 0xFC, 0x7E, 0x0F, 0xFF, 0x00,
  0x00, 0x1F, 0xFF, 0xF8, 0xFF, 0x0F, 0xFF, 0x00, 0x00, 0x0F, 0xFF, 0xF0, 0xFF, 0xC7, 0xFE, 0x00,
  0x00, 0x03, 0xFF, 0xE1, 0xFF, 0xE7, 0xF8, 0x00, 0x00, 0x00, 0xFF, 0x81, 0xFF, 0xE3, 0xF8, 0x00,
  0x00, 0x00, 0x00, 0x01, 0xFF, 0xF3, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xC0, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xFC, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

String text_list[2][2] = {{"text1", "text2"}, {"text3", "text4"}};
const uint8_t bitmap_list[2] = {very_funny, summer};

void print_text_bitmap(const uint8_t picture[], String arr[])
{
  display.clearDisplay();
  display.setTextSize(1);      // Normal 1:1 pixel scale
  display.setTextColor(WHITE); // Draw white text
  display.cp437(true);         // Use full 256 char 'Code Page 437' font
  display.setCursor(66, 0);
  display.print(arr[0]);
  display.setCursor(66, 10);
  display.print(arr[1]);
 
  display.drawBitmap(0, 0, picture, 64, 64, 1);
  display.display();
}

void setup()
{
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
}

void loop()
{

//Green code, it works
print_text_bitmap(summer, text_list[1]);

//Red code, it's not working
print_text_bitmap(bitmap_list[1], text_list[1]);
}




Buura

#1
Apr 18, 2019, 09:23 am Last Edit: Apr 18, 2019, 09:24 am by Buura
I solved the problem with these code:

Code: [Select]

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

#define MUX_Address 0x70        // TCA9548A Encoders address
#define DS3231_I2C_ADDRESS 0x68 // DS3231 address
#define SCREEN_WIDTH 128        // OLED display width, in pixels
#define SCREEN_HEIGHT 64        // OLED display height, in pixels
#define OLED_RESET     4        // Reset pin # (or -1 if sharing Arduino reset pin)

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

const unsigned char summer[] PROGMEM =
{
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x03, 0xFF, 0xF0, 0x00, 0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xFF, 0xFF,
 0x1F, 0x80, 0x3F, 0x00, 0x00, 0xF0, 0x7F, 0xFE, 0x0F, 0x00, 0x1F, 0x00, 0x01, 0xE0, 0x07, 0xFE,
 0x0E, 0x00, 0x0E, 0x00, 0x01, 0xE0, 0x00, 0xFE, 0x0E, 0x00, 0x0F, 0x00, 0x01, 0xE0, 0x00, 0x3E,
 0x3E, 0x00, 0x07, 0xC0, 0x03, 0xC0, 0x00, 0x0C, 0xFE, 0x00, 0x07, 0xE0, 0x03, 0xC0, 0x00, 0x00,
 0x3E, 0x00, 0x0F, 0x80, 0x03, 0xC0, 0x00, 0x00, 0x0E, 0x00, 0x0E, 0x00, 0x07, 0x80, 0x00, 0x00,
 0x0F, 0x00, 0x0E, 0x00, 0x07, 0x80, 0x00, 0x00, 0x0F, 0x00, 0x1F, 0x00, 0x07, 0x80, 0x00, 0x00,
 0x1F, 0x80, 0x3F, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x3F, 0xE0, 0x7F, 0x80, 0x0F, 0x00, 0x00, 0x00,
 0x01, 0xFF, 0xF0, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xF0, 0x00, 0x1E, 0x00, 0x00, 0x00,
 0x01, 0xFF, 0xF0, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x01, 0xCF, 0x30, 0x00, 0x3C, 0x00, 0x00, 0x00,
 0x01, 0x0E, 0x18, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00,
 0x00, 0x04, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x1F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0xE0, 0x00, 0x00,
 0x00, 0x00, 0x7F, 0xFF, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00,
 0x00, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0x00,
 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x03, 0xFF, 0x00, 0x3F, 0xFC, 0x01, 0xFF, 0xC0,
 0x01, 0xFC, 0x00, 0x0F, 0xF0, 0x00, 0x3F, 0x80, 0x00, 0xF8, 0x00, 0x03, 0xC0, 0x00, 0x1E, 0x00,
 0x80, 0x00, 0x0C, 0x00, 0x00, 0x70, 0x00, 0x03, 0xF8, 0x00, 0x7F, 0xC0, 0x03, 0xFE, 0x00, 0x1F,
 0xFC, 0x01, 0xFF, 0xE0, 0x0F, 0xFF, 0x80, 0x3F, 0xFF, 0x03, 0xFF, 0xF8, 0x1F, 0xFF, 0xC0, 0xFF,
 0x3F, 0xFF, 0xE1, 0xFF, 0xFF, 0x87, 0xFF, 0xFC, 0x0F, 0xFF, 0x80, 0x7F, 0xFE, 0x01, 0xFF, 0xF0,
 0x07, 0xFF, 0x00, 0x1F, 0xF8, 0x00, 0xFF, 0xC0, 0x01, 0xFC, 0x00, 0x07, 0xE0, 0x00, 0x3F, 0x00
};

const unsigned char very_funny[] 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, 0x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x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};


struct text_bitmap
{
const uint8_t* picture;
char text0[10];
char text1[10];
char text2[10];
char text3[10];
char text4[10];
char text5[10];
};

struct text_bitmap text_bitmap_list[2] = {{very_funny, "aaaa", "bbbb", "cccc", "dddd", "eeee", "ffff"}, {sakura, "gggg", "hhhh", "iiii", "jjjj", "kkkk", "llll"}};


void print_text_bitmap(struct text_bitmap arr[], int i)
{
display.clearDisplay();
display.setTextSize(1);      // Normal 1:1 pixel scale
display.setTextColor(WHITE); // Draw white text
display.cp437(true);         // Use full 256 char 'Code Page 437' font
display.setCursor(66, 0);
display.print(arr[i].text0);
display.setCursor(66, 10);
display.print(arr[i].text1);
display.setCursor(66, 20);
display.print(arr[i].text2);
display.setCursor(66, 30);
display.print(arr[i].text3);
display.setCursor(66, 40);
display.print(arr[i].text4);
display.setCursor(66, 50);
display.print(arr[i].text5);
display.drawBitmap(0, 0, arr[i].picture, 64, 64, 1);
display.display();
}
 

void setup()
{
 display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
}

void loop()
{
print_text_bitmap(text_bitmap_list[1]);
}

Go Up