This example project shows how to make random flickering pixels using ATtiny13 and popular 8×8 matrix LED display based on MAX7219/MAX7221. Complete project code is on GitHub.
MAX7219/MAX7221 library for 8×8 matrix LED display
A lightweight library for 8×8 matrix LED displays based on MAX7219/MAX7221 chip that works with tinyAVR family (ATtiny13, ATtiny25, ATtiny45, ATtiny85) can be found here .
Parts
- ATtiny13 – i.e. MBAVR-1 development board
- 8×8 LED display based on MAX7219/MAX7221
Circuit Diagram
Firmware
This code is written in C and can be compiled using the avr-gcc. More details on how compile this project is here.
#include <stdint.h> #include <util/delay.h> #include "max7219.h" #define LFSR_SEED (213) static uint16_t prng_lfsr16(void) { static uint16_t cnt16 = LFSR_SEED; return (cnt16 = (cnt16 >> 1) ^ (-(cnt16 & 1) & 0xB400)); } int main(void) { uint8_t row, col, i = 0; /* setup */ MAX7219_init(); MAX7219_set_intensity(8); /* loop */ while (1) { row = (prng_lfsr16() + col) % 8; col = (prng_lfsr16() + row) % 8; MAX7219_set_pixel(row, col, ++i & 0x01); _delay_ms(5); } }
Hello,
Thanks for this MAX7219 ATTINY code. I have developed scrolling LED ticker for ATTINY13 + 4 MAX 7219 modules – it is available here : https://github.com/mcore1976/ledbanner
Even on 1024 bytes Flash + 64 bytes RAM it is possible…
look here : https://github.com/mcore1976/ledbanner/blob/main/main13.c
Hi, It’s cool! 🙂
/LP
Hi, thanks for this library. I have done 4 characters LED news ticker here : https://github.com/mcore1976/ledbanner
With only 1024 bytes of Flash and 64 bytes of RAM… Yes… It is possible even on this small ATTINY13 .. .It can display scrolling messages up to 100 characters long
Could you edit? Since this is your project and I think it will be very easy for you to change it under 7 matrices.
Hello, help me to run a random for 7 pieces max7219
Hi,
it’s kind of old project. I don’t remember the details.
/l