LedControl Libary

Mosquera

Mitglied
Hallo

ich habe mir verschiedene Gesichter auf meiner 8x8 Matrix ausgeben lassen.
Momentan benutze ich noch die LedControl Libary, die ich aber weg lassen wollte.
Habe mir mal die Libary gezogen und versucht die wichtigen Sachen rauszuholen,
funktioniert nur leider nicht. Ich lasse euch mal mein Code hier.

C:
//#include <LedControl.h>

// DIN: 12; CS: 10; CLK: 11
//LedControl lc = LedControl(12,11,10,1);

int dataPin = 12;
int clkPin = 11;
int csPin = 10;
int numDevices = 1;

byte happy[8] = {B00111100,B01000010,B10100101,B10000001,B10100101,B10011001,B01000010,B00111100};
byte sad[8] = {B00111100,B01000010,B10100101,B10000001,B10011001,B10100101,B01000010,B00111100};
byte grim[] = {B00111100,B01000010,B10100101,B10000001,B10111101,B10000001,B01000010,B00111100};

void shutdown(int addr, bool status);
void clearDisplay(int addr);
void setIntensity(int addr, int intensity);
void setRow(int addr, int row, byte value);

void setup() {
  lc.shutdown(0,false);
  lc.shutdown(1,false);
  lc.clearDisplay(0);
  lc.clearDisplay(1);
  lc.setIntensity(0,8);
}

void happyface() {
  for (int i=0; i<8; i++)
  lc.setRow(0,i,happy[i]);
}

void sadface() {
  for (int i=0; i<8; i++)
  lc.setRow(0,i,sad[i]);
}

void grimface() {
  for (int i=0; i<8; i++)
  lc.setRow(0,i,grim[i]);
}

void loop() {
  happyface();
  delay(2000);
  sadface();
  delay(2000);
  grimface();
  delay(2000);
}

Mit freundlichen Grüßen
 

Neue Themen


Oben