Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#include <SPI.h>
#define CHIP_SELECT_PIN 10
void setup() {
// Setup SPI communication for the MAX7221.
// Test for 1 second.
send(0x0F, 0x01);
send(0x0F, 0x00);
// Turn off decoding.
send(0x09, 0x00);
// Set scan limiter to display all registers.
send(0x0B, 0x07);
// Set display intensity (0-F).
send(0x0A, 0x04);
// Turn on display.
send(0x0C, 0x01);
// Clear all the display registers.
send(0x01, 0x00);
send(0x02, 0x00);
send(0x03, 0x00);
send(0x04, 0x00);
send(0x05, 0x00);
send(0x06, 0x00);
send(0x07, 0x00);
send(0x08, 0x00);
void loop() {
send(0x01, random(256));
send(0x02, random(256));
send(0x03, random(256));
send(0x04, random(256));
send(0x05, random(256));
send(0x06, random(256));
send(0x07, random(256));
send(0x08, random(256));
void send(byte address, byte value) {
digitalWrite(CHIP_SELECT_PIN, LOW);
digitalWrite(CHIP_SELECT_PIN, HIGH);

This comment has been minimized.

Show comment Hide comment

nixpulvis Jan 23, 2018

This has been superseded by


nixpulvis commented Jan 23, 2018

This has been superseded by

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment