Enter Your Project for a chance to win an Oscilloscope Grand Prize Package for the Most Creative Vision Thing Project! | Project14 Home | |
Monthly Themes | ||
Monthly Theme Poll |
Following on from getting the 1x8 LDR array to display on the 8x8 LED matrix display with just two levels (ON and OFF) I tried implementing my idea of multiplexing the whole display in software to create a sort of PWM effect that might mimic grey scale display. The GFX library contains a function to display a bit mapped image on the display and this seemed the most likely method of updating the whole display quickly. So I created four arrays of bit mapped images as shown below.
static const uint8_t PROGMEM // Bitmaps are stored in program memory
greyimg1[8] =
{ B11111111,
B11111111,
B11111111,
B11111111,
B11101111,
B11111111,
B11111111,
B11111111 };
static const uint8_t PROGMEM
greyimg2[8] =
{ B11111100,
B11111100,
B11111100,
B11111100,
B11101100,
B11111100,
B11111100,
B11111100 };
static const uint8_t PROGMEM
greyimg3[8] =
{ B11110000,
B11110000,
B11110000,
B11110000,
B11100000,
B11110000,
B11110000,
B11110000 };
static const uint8_t PROGMEM
greyimg4[8] =
{ B11000000,
B11000000,
B11000000,
B11000000,
B11000000,
B11000000,
B11000000,
B11000000 };
Then I used a while loop to sequence through each of the four bit mapped images.
while (1)
{
matrix.clear();
matrix.drawBitmap(0, 0, greyimg1, 8, 8, LED_ON);
matrix.writeDisplay(); // write to display
// delay(1000);
matrix.clear();
matrix.drawBitmap(0, 0, greyimg2, 8, 8, LED_ON);
matrix.writeDisplay(); // write to display
// delay(1000);
matrix.clear();
matrix.drawBitmap(0, 0, greyimg3, 8, 8, LED_ON);
matrix.writeDisplay(); // write to display
// delay(1000);
matrix.clear();
matrix.drawBitmap(0, 0, greyimg4, 8, 8, LED_ON);
matrix.writeDisplay(); // write to display
// delay(1000);
} /* while */
These were then output to the LED display one after another, see the video below. This is stepping through the four images slowly so that I could check that it was cycling properly.
This looked like it might work so I removed the software delay between the different bit mapped images and obtained the result shown below.
This is a time-multiplexed image so the video cannot really keep up with it and it looks a bit weird, but essentially what seems to be happening is that the multiplexing implemented by the HT16K33 controller is slower than needed and seems to take longer than the time taken between bit mapped images. The result is just a lot of visible flickering rather than grey levels of LED brightness. Ah well, it was worth a try. Now I know more about how the LED matrix display works. Even if it had worked I'm not sure I could have used it as the matrix.drawBitmap() function requires the image to be in programme memory rather than the normal RAM area used for variables.
It is not too important that this doesn't work as this display is just for information anyway so that I can check everything is working. I will still be able to feed grey scale images into the ANN to classify images.
Dubbie
Top Comments