-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Support for displaying output values to an RGB Matrix, LED strips for values/energy (%), individual LEDs, speakers for extra fun.
RGB Matrix: https://www.digikey.com.au/en/products/detail/adafruit-industries-llc/5036/14671681
LED strip: https://www.digikey.com.au/en/products/detail/adafruit-industries-llc/2540/9770543
LED: https://www.digikey.com.au/en/products/detail/sparkfun-electronics/11120/5673801
speakers: https://www.digikey.com.au/en/products/detail/adafruit-industries-llc/1314/7902282
example (this could be a matrix or led strip around an arcade cab):
matrix_ledstrip.mp4
What I've done so far:
#include <Adafruit_Protomatter.h>
#include <Adafruit_GFX.h>
#include <Fonts/Org_01.h>
#include <Adafruit_NeoPixel.h>
// RGB Matrix Configuration
#define MATRIX_WIDTH 64
uint8_t matrixRgbDataPins[] = {26, 27, 38, 16, 17, 18};
uint8_t matrixAddressPins[] = {2, 3, 4, 5};
uint8_t matrixClockPin = 23;
uint8_t matrixLatchPin = 6;
uint8_t matrixOutputEnable = 9;
Adafruit_Protomatter rgbMatrix(
MATRIX_WIDTH,
6, // Bit depth
1, // Chain length
matrixRgbDataPins,
4, // Address pin count
matrixAddressPins,
matrixClockPin,
matrixLatchPin,
matrixOutputEnable,
true // Double buffer
);
// NeoPixel Configuration
#define NEOPIXEL_PIN 8
#define NEOPIXEL_COUNT 107
#define NEOPIXEL_BRIGHTNESS 100
#define NEO_BLINK_INTERVAL 1000
Adafruit_NeoPixel neoPixels(NEOPIXEL_COUNT, NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800);
unsigned long lastNeoPixelUpdate = 0;
bool neoPixelBlinkState = false;
void setup() {
Serial.begin(9600);
// Initialize RGB Matrix
rgbMatrix.begin();
rgbMatrix.setFont(&Org_01);
rgbMatrix.setTextColor(0x07FF);
rgbMatrix.show();
// Initialize NeoPixels
neoPixels.begin();
neoPixels.setBrightness(NEOPIXEL_BRIGHTNESS);
neoPixels.show();
}
void updateRGBMatrix() {
rgbMatrix.setCursor(0, 6);
rgbMatrix.print("CREDITS:");
rgbMatrix.setCursor(0, 12);
rgbMatrix.print("LIVES:");
rgbMatrix.setCursor(0, 18);
rgbMatrix.print("MAGAZINES:");
rgbMatrix.setCursor(0, 24);
rgbMatrix.print("AMMO:");
rgbMatrix.setCursor(0, 30);
rgbMatrix.print("GRENADES:");
rgbMatrix.show();
}
void updateNeoPixels() {
if (millis() - lastNeoPixelUpdate >= NEO_BLINK_INTERVAL) {
lastNeoPixelUpdate = millis();
neoPixelBlinkState = !neoPixelBlinkState;
uint32_t color = neoPixelBlinkState ? neoPixels.Color(255, 0, 0) : neoPixels.Color(0, 0, 0);
for (int i = 0; i < NEOPIXEL_COUNT; i++) {
bool isEndSection = (i < 16 || i >= NEOPIXEL_COUNT - 16);
neoPixels.setPixelColor(i, isEndSection ? color : neoPixels.Color(0, 0, 0));
}
neoPixels.show();
}
}
void loop() {
updateRGBMatrix();
updateNeoPixels();
}
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request