#include <LedControl.h>
LedControl lc = LedControl(11, 13, 10, 1);
void setup() {
lc.shutdown(0, false);
lc.setIntensity(0, 8);
lc.clearDisplay(0);
}
void loop() {
int v = analogRead(A0);
int h = analogRead(A1);
if(v > 800){ //up
lc.setLed(0, 0, 1, 1);
delay(1);
}else{
lc.setLed(0, 0, 1, 0);
}
if(v > 800){ //down
lc.setLed(0, 2, 1, 1);
delay(1);
}else{
lc.setLed(0, 2, 1, 0);
}
if(v > 800){ //right
lc.setLed(0, 1, 0, 1);
delay(1);
}else{
lc.setLed(0, 1, 0, 0);
}
if(v > 800){ //left
lc.setLed(0, 1, 2, 1);
delay(1);
}else{
lc.setLed(0, 1, 2, 0);
}
}