#include <LedControl.h>
int Green = A10;
int DIN = 10;
int CS = 9;
int CLK = 8;
LedControl lc = LedControl(DIN, CLK, CS, 0);
void setup() {
pinMode(Green, INPUT_PULLUP);
lc.shutdown(0,false);
lc.setIntensity(0,15);
}
void loop() {
if (digitalRead(Green) == 0){
smile();
}
else {
sad();
}
}
void smile()
{
byte SMILE[8] = {0x3C, 0x42, 0xA5, 0x81, 0xA5, 0x99, 0x42, 0x3C};
for (int i = 0; i < 8; i++) {
lc.setRow(0, i, SMILE[i]);
}
}
void sad()
{
byte SAD[8] = {0x3C, 0x42, 0xA5, 0x81, 0x99, 0xA5, 0x42, 0x3C};
for (int i = 0; i < 8; i++) {
lc.setRow(0, i, SAD[i]);
}
}