Skip to content

Instantly share code, notes, and snippets.

@jboecker
Created November 25, 2016 18:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jboecker/e2d3a1972a8ac442f923955c79858c3c to your computer and use it in GitHub Desktop.
Save jboecker/e2d3a1972a8ac442f923955c79858c3c to your computer and use it in GitHub Desktop.
This is a simple example sketch to test a 7-Segment display driven by a MAX7219 chip.
#include "LedControl.h"
// modified LCDemo7Segment example from the LedControl library
/*
pin 2 = DataIn
pin 3 = CLK
pin 4 = LOAD
1 = Anzahl hintereinandergeschalteter MAX7219-Chips
*/
LedControl lc=LedControl(2,3,4,1);
void setup() {
/*
The MAX72XX is in power-saving mode on startup,
we have to do a wakeup call
*/
lc.shutdown(0,false);
/* Set the brightness to a medium values */
lc.setIntensity(0,8);
/* and clear the display */
lc.clearDisplay(0);
// set all digits to '8' to make sure all LEDs work
for (unsigned char i=0; i<8; i++) {
lc.setDigit(0, i, 8, false);
}
delay(1000);
// print '0' to '7' to digits 0 through 7 to idenfify which is which
for (unsigned char i=0; i<8; i++) {
lc.setDigit(0, i, i, false);
}
}
void loop() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment