#include "LedControl.h"
LedControl lc=LedControl(/*DIN*/11,/*CLK*/13,/*CS*/10,/*number of displays*/1); // initialization of the display
void setup() {
lc.shutdown(0,false);
lc.setIntensity(0,8);
lc.clearDisplay(0);
pinMode(A0, INPUT); // set pin A0 to be analog input for reading the potentiometer value
}
void loop() { // main loop
int potentiometer_value = analogRead(A0); // read the potentiometer value from pin A0
potentiometer_value = map(potentiometer_value, 0, 1023, 0, 32); // remap the value from 0-1023 to 0-32
for(int row=0;row<8;row++) { // for every row
for(int col=0;col<8;col++) { // for every column
if ((col + (row * 8)) < potentiometer_value) { // if the current LED index is smaller than the potentiometer value...
lc.setLed(0,row,col,true); // turn the LED on
} else { // otherwise...
lc.setLed(0,row,col,false); // turn the LED off
}
}
}
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
matrix1:V+
matrix1:GND
matrix1:DIN
matrix1:CS
matrix1:CLK
matrix1:V+.2
matrix1:GND.2
matrix1:DOUT
matrix1:CS.2
matrix1:CLK.2
pot1:GND
pot1:SIG
pot1:VCC