Created
December 24, 2022 17:58
-
-
Save naivekook/7aa427def09b314375735f3af67833bc to your computer and use it in GitHub Desktop.
Face rotation for EXP8226 and Max7219
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <LedControl.h> | |
int DIN = 12; // D6 | |
int CS = 15; // D8 | |
int CLK = 14; // D5 | |
unsigned long delaytime=1000; | |
LedControl lc=LedControl(DIN,CLK,CS,1); | |
byte smile[8]= {0x3C,0x42,0xA5,0x81,0xA5,0x99,0x42,0x3C}; | |
byte neutral[8]={0x3C,0x42,0xA5,0x81,0xBD,0x81,0x42,0x3C}; | |
byte sad[8]= {0x3C,0x42,0xA5,0x81,0x99,0xA5,0x42,0x3C}; | |
void setup() { | |
lc.shutdown(0,false); | |
lc.setIntensity(0,8); | |
lc.clearDisplay(0); | |
} | |
void loop(){ | |
printByte(smile); | |
delay(delaytime); | |
printByte(neutral); | |
delay(delaytime); | |
printByte(sad); | |
delay(delaytime); | |
} | |
void printByte(byte character []) | |
{ | |
int i = 0; | |
for(i=0;i<8;i++) | |
{ | |
lc.setRow(0,i,character[i]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment