#include "LedControl.h"
/*
pin 6 is connected to the DataIn
pin 7 is connected to the CLK
pin 8 is connected to LOAD
*/
LedControl lc=LedControl(6,7,8,1);
unsigned long delaytime=100;
void setup() {
lc.shutdown(0,false);
lc.setIntensity(0,8);
lc.clearDisplay(0);
}
void loop()
{
int val = analogRead(A0);
val = map(val, 0, 1023, 0, 8);
if(val == 1)
{
lc.setRow(0,0,B10000000);
}
if(val == 2)
{
lc.setRow(0,0,B10000000);
lc.setRow(0,1,B11000000);
}
if(val == 3)
{
lc.setRow(0,0,B10000000);
lc.setRow(0,1,B11000000);
lc.setRow(0,2,B11100000);
}
if(val == 4)
{
lc.setRow(0,0,B10000000);
lc.setRow(0,1,B11000000);
lc.setRow(0,2,B11100000);
lc.setRow(0,3,B11110000);
}
if(val == 5)
{
lc.setRow(0,0,B10000000);
lc.setRow(0,1,B11000000);
lc.setRow(0,2,B11100000);
lc.setRow(0,3,B11110000);
lc.setRow(0,4,B11111000);
}
if(val == 6)
{
lc.setRow(0,0,B10000000);
lc.setRow(0,1,B11000000);
lc.setRow(0,2,B11100000);
lc.setRow(0,3,B11110000);
lc.setRow(0,4,B11111000);
lc.setRow(0,5,B11111100);
}
if(val == 7)
{
lc.setRow(0,0,B10000000);
lc.setRow(0,1,B11000000);
lc.setRow(0,2,B11100000);
lc.setRow(0,3,B11110000);
lc.setRow(0,4,B11111000);
lc.setRow(0,5,B11111100);
lc.setRow(0,6,B11111110);
}
if(val == 8)
{
lc.setRow(0,0,B10000000);
lc.setRow(0,1,B11000000);
lc.setRow(0,2,B11100000);
lc.setRow(0,3,B11110000);
lc.setRow(0,4,B11111000);
lc.setRow(0,5,B11111100);
lc.setRow(0,6,B11111110);
lc.setRow(0,7,B11111111);
}
lc.clearDisplay(0);
}