Skip to content

Instantly share code, notes, and snippets.

@gregorykelleher
Created June 15, 2015 12:52
Show Gist options
  • Save gregorykelleher/e976aef02883b979208a to your computer and use it in GitHub Desktop.
Save gregorykelleher/e976aef02883b979208a to your computer and use it in GitHub Desktop.
#include "LedControl.h"
LedControl lc=LedControl(12,11,10,1);
void setup(){
Serial.begin(9600);
lc.shutdown(0,false);
lc.setIntensity(0,10);
lc.clearDisplay(0);
for(int x =0; x<=9999; x++){
outputNumber(x);
delay(125);
}
}
void outputNumber(int counter)
{
int nDivider = 10;
int digCnt = 0;
boolean allDone = false;
int queryAns = 0;
do {
queryAns = counter%nDivider;
if(counter==queryAns) allDone=true;
lc.setDigit(0, digCnt, queryAns/(nDivider/10), false);
digCnt = digCnt + 1;
nDivider*=10;
}
while(!allDone); //false
}
void loop(){
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment