Initial commit

This commit is contained in:
Yash Karandikar 2023-03-04 16:35:51 -06:00
commit a8b216604b
3 changed files with 50 additions and 0 deletions

31
arduino_cava.ino Normal file
View file

@ -0,0 +1,31 @@
#include "LedControl.h"
LedControl leds = LedControl(2, 4, 3, 2);
void setup() {
for (int i = 0; i < leds.getDeviceCount(); i++) {
leds.shutdown(i, false);
leds.clearDisplay(i);
}
Serial.begin(1000000);
}
void loop() {
if (Serial.available()) {
String line = Serial.readStringUntil('\n');
for (int i = 0; i < line.length(); i += 2) {
int x = i / 2;
int y = (int) line.charAt(i) - '0';
byte val = 0;
for (int j = 0; j <= y; j++) {
val ^= (1 << j);
}
if (x > 7) {
leds.setRow(1, x-8, val);
} else {
leds.setRow(0, x, val);
}
}
}
}

6
cava_run.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
SERIAL=/dev/ttyACM0
sudo stty -F $SERIAL cs8 -cstopb -parenb 1000000
(cava cava -p ./config | sudo tee $SERIAL) >/dev/null

13
config Normal file
View file

@ -0,0 +1,13 @@
[general]
bars = 16
autosens = 1
[output]
method = raw
data_format = ascii
ascii_max_range = 7
bit_format = 8bit
[smoothing]
monstercat = 1