Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
polyhedra64
Published © GPL3+

Led Matrix Counter :)

An led matrix that displays values from a potentiometer

IntermediateShowcase (no instructions)224
Led Matrix Counter :)

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
LED Dot Matrix Display, Red
LED Dot Matrix Display, Red
×1
Evaluation Kit, MAX14745 Wearable Charge Management Solution
Evaluation Kit, MAX14745 Wearable Charge Management Solution
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1

Story

Read more

Schematics

Wiring connectinons

I dont have fritzing so this the next best thing \_('/')_/

Code

The code

C/C++
Plug in the arduino and wire it up run the code you may need to download a library called LedControl
:)
#include <LedControl.h>

const int DIN = 12;
const int CS =  11;
const int CLK = 10;

//byte smile[8]=   {0x3C,0x42,0xA5,0x81,0xA5,0x99,0x42,0x3C};
//byte neutral[8]= {0x3C,0x42,0xA5,0x81,0xBD,0x81,0x42,0x3C};
//byte frown[8]=   {0x3C,0x42,0xA5,0x81,0x99,0xA5,0x42,0x3C};
//byte m[8]=     {0xE7,0xFF,0xFF,0xDB,0xDB,0xDB,0xC3,0xC3};
byte One[8] = {0x00,0x00,0x88,0x84,0xFE,0x80,0x80,0x00,};
byte Two[8] = {0x00,0x00,0x88,0xC4,0xA4,0x94,0x88,0x00,};
byte Three[8] = {0x00,0x00,0x82,0x91,0x91,0xA9,0xEE,0x00,};
byte Four[8] = {0x00,0x00,0x3F,0x20,0x20,0x20,0xFF,0x20,};
byte Five[8] = {0x00,0x00,0x9F,0x91,0x91,0x91,0x61,0x00,};
byte Six[8] = {0x00,0x00,0x78,0x8C,0x8A,0x89,0x71,0x00,};
byte Seven[8] = {0x00,0x81,0x41,0x21,0x11,0x09,0x07,0x01,};
byte Eight[8] = {0x00,0x6E,0x91,0x91,0x91,0x91,0x6E,0x00,};
byte Nine[8] = {0x00,0x06,0x09,0x09,0x09,0xFE,0x00,0x00,};
byte Ten[8] = {0x04,0x02,0x01,0xFF,0x00,0xFF,0x81,0xFF,};
byte Eleven[8] = {0x04,0x02,0xFF,0x00,0x04,0x02,0xFF,0x00,};
byte Twelve[8] = {0x04,0x02,0xFF,0x00,0xE4,0x92,0x8A,0x84,};
byte Thirteen[8] = {0x04,0x02,0xFF,0x00,0x82,0x92,0x92,0xFE,};
byte Fourteen[8] = {0x04,0x02,0xFF,0x00,0x1E,0x10,0x10,0xFE,};
byte Fifteen[8] = {0x04,0x02,0xFF,0x00,0x9E,0x92,0x92,0xE2,};
byte Sixteen[8] = {0x04,0x02,0xFF,0x00,0xFE,0x92,0x92,0xE2,};
byte Error[8] = {0x7F,0x49,0x49,0x00,0x7F,0x0D,0x77,0x00,};

LedControl lc=LedControl(DIN,CLK,CS,0);

void setup(){
 lc.shutdown(0,false);       //The MAX72XX is in power-saving mode on startup
 lc.setIntensity(0,1);      // Set the brightness to maximum value
 lc.clearDisplay(0);         // and clear the display
 Serial.begin(9600);
}

void loop(){ 

    int Number = analogRead(A0);
    int checknum = Number/64+1;
    if(checknum == 1){
      printByte(One);
    }else if(checknum == 2){
      printByte(Two);
    }else if(checknum == 3){
      printByte(Three);
    }else if(checknum == 4){
      printByte(Four);
    }else if(checknum == 5){
      printByte(Five);
    }else if(checknum == 6){
      printByte(Six);
    }else if(checknum == 7){
      printByte(Seven);
    }else if(checknum == 8){
      printByte(Eight);
    }else if(checknum == 9){
      printByte(Nine);
    }else if(checknum == 10){
      printByte(Ten);
    }else if(checknum == 11){
      printByte(Eleven);
    }else if(checknum == 12){
      printByte(Twelve);
    }else if(checknum == 13){
      printByte(Thirteen);
    }else if(checknum == 14){
      printByte(Fourteen);
    }else if(checknum == 15){
      printByte(Fifteen);
    }else if(checknum == 16){
      printByte(Sixteen);
    }else{
      printByte(Error);
    }
    //lc.clearDisplay(0);
    

}


void printByte(byte character [])
{
  int i = 0;
  for(i=0;i<8;i++)
  {
    lc.setRow(0,i,character[i]);
  }
}

Credits

polyhedra64

polyhedra64

4 projects • 2 followers

Comments