Los Electrofaster
Published © GPL3+

Value of potentiometer using a 8x8 matrix LEDs

How create a graphical interpretation for the analog reading of a potentiometer.

BeginnerFull instructions provided1 hour789
Value of potentiometer using a 8x8 matrix LEDs

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
8x8 Matrix LEDs with MAX7219
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×10

Software apps and online services

Arduino IDE
Arduino IDE
Friting

Story

Read more

Schematics

Circuit diagram

Connection for the project using 8x8 matrix LEDs

Code

Potentiometer value with 8x8 matrix LEDs

Arduino
Code of the project
#include <LedControl.h>
int DIN = 11;
int CS =  10;
int CLK = 13;
LedControl lc=LedControl(DIN,CLK,CS,1);

void setup(){
 lc.shutdown(0,false); 
 lc.setIntensity(0,15);
 lc.clearDisplay(0);
}
void printByte(byte character []){
  int i = 0;
  for(i=0;i<8;i++){
    lc.setRow(0,i,character[i]);
  }
}

void loop(){ 
  byte cero[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
  int value = analogRead(A0); // read of potentiometer value
  int scale = map(value, 0, 1000, 0, 8); // map function to get brihtness

  for (int i=0;i<scale;i++){
    cero[i] = 0xff;
  }

  printByte(cero);

  delay(100);
}

Credits

Los Electrofaster

Los Electrofaster

8 projects • 7 followers

Comments