Arduino + MAX7219 + Led matrica 8×8

Seniai jau darytas projektas tik niekaip negalėjau (nesugebėjau) aprašyti jo. Kilo idėja Arduino pajungti prie šviesos diodų matricos panaudojant MAX7219 Led valdiklį (draiverį). Kas įdomausia – į vieną eilę 3 valdymo laidais galima pajungti iki 8 tokių modulių. Gaunama 8×64 taškų eilutė.

Pati schema elementari, plokštė gavosi 6cmx6cm

programos kodas:

#include „LedControl.h“
int devices = 3; //moduliu skaicius
LedControl lc = LedControl (10, 12, 11, devices);

unsigned long delaytime = 50;
int row;
int col;
int address;

void setup (){
	for (int address = 0; address < devices; address++){
		lc.shutdown (address, false);
		lc.setIntensity (address, 12);
		lc.clearDisplay (address);}
	}

void clr_disp (int dev){
	delay (1000);
	for (address = 0; address < dev; address++){
		lc.clearDisplay (address);}
	}

void fill_pixel (int dev){
	for (row = 0; row < 8; row++){
		for (address = 0; address < dev; address++){
			for (col = 0; col < 8; col++){
				delay (delaytime);
				lc.setLed (address, row, col, true);}
			}
		}
	}

void fill_col_right (int dev, int b){
	for (address = 0; address < dev; address++){
		for (col = 0; col < 8; col++){
			delay (delaytime);
			lc.setColumn (address, col, b);}
		}
	}

void fill_col_left (int dev, int b){
	for (address = dev-1; address >= 0; address--){
		for (col = 7; col >= 0; col--;){
			delay (delaytime);
			lc.setColumn (address, col, b);}
		}
	}

void fill_row_down (int dev, int b){
	for (row = 0; row < 8; row++){
		for (address = 0; address < dev; address++){
			lc.setRow (address, row, b);}
			delay (delaytime);
		}
	}

void fill_row_up (int dev, int b){
	for (row = 7; row >= 0; row--;){
		for( address = 0; address < dev; address++){
			lc.setRow (address, row, b);}
			delay (delaytime);
		}
	}

void loop (){
	clr_disp (devices);
	fill_col_right (devices, 255);
	fill_row_down (devices, 0);
	fill_row_up (devices, 255);
	fill_col_left (devices, 0);
	}

 

ir gabalėlis youtubo

7 komentarai

    Gonzalo

    Thank you for sharing your simple and clear code.

    yonis

    Hi, how do you connect (join) all of them, do you the wiring pls

      gdrs

      Make myself PCB

      http://www.youtube.com/watch?v=vXf71oZbyCA

    borjang

    hi : Thanks for sharing the pcb schematic and it looks great. But your code have some  bugs. line 43 shoule be →   「  for (col = 7; col >= 0; col–-){

     line 58 shoule be →       「   for (row = 7; row >= 0; row–-){  

      gdrs

      Thanks
      it was a mistake 🙂
      FIXED

    Andrius

    sveiki gal galite ikelti pcb?

    arduino+max7219+led matrix | RoboTechno

    […] Lien vers le site ici […]

Parašykite komentarą

El. pašto adresas nebus skelbiamas. Būtini laukeliai pažymėti *

*
*

Time limit is exhausted. Please reload CAPTCHA.

Brukalų kiekiui sumažinti šis tinklalapis naudoja Akismet. Sužinokite, kaip apdorojami Jūsų komentarų duomenys.