Reflecting LED Matrix Display
hi everyone
i working on spectrum analyzer , displaying right , left channel. however, way coded, left , right display in same way on individual led matrices, low frequencies on far left high frequencies on far right.
i want modify code low -> high frequencies on left channel, , high -> low frequencies on right channel.
here code
hopefully, can tell, function reads 1 of 8 data values in array, right or left, , outputs row related value in array. data value 0 outputs row 0, value 1 outputs row 1, , on through 8 rows, 0-7. want right matrix take data value 0 , output row 7, value 1 output on row 6, , on, i'm not sure how go it.
would love suggestions try , working.
i working on spectrum analyzer , displaying right , left channel. however, way coded, left , right display in same way on individual led matrices, low frequencies on far left high frequencies on far right.
i want modify code low -> high frequencies on left channel, , high -> low frequencies on right channel.
here code
code: [select]
//led matrix stuff
#include <ledcontrol.h>
#include <binary.h>
// inputs: din pin, clk pin, load pin. number of chips
ledcontrol lc = ledcontrol(12, 11, 10, 2);
// msgeq7 spectrum analyser shield - basic demonstration
int strobe = 4; // strobe pins on digital 4
int res = 5; // reset pins on digital 5
int left[8]; // store band values in these arrays
int right[8];
int band;
void setup ()
{
//mesgeq7 setup
serial.begin(115200);
pinmode(res, output); // reset
pinmode(strobe, output); // strobe
digitalwrite(res,low); // reset low
digitalwrite(strobe,high); //pin 5 reset on shield
//led matrix setup
lc.shutdown(0,false); //turns on display
lc.setintensity(0,0); //maximum brightness, 0-15
lc.cleardisplay(0); //clears display
lc.shutdown(1,false); //turns on display
lc.setintensity(1,0); //maximum brightness, 0-15
lc.cleardisplay(1); //clears display
}
void readmsgeq7()
// function read 7 band equalizers
{
digitalwrite(res, high);
digitalwrite(res, low);
for(band=0; band <8; band++)
{
digitalwrite(strobe,low); // strobe pin on shield - kicks ic next band
delaymicroseconds(1000); //
left[band] = analogread(0); // store left band reading
right[band] = analogread(1); // ... , right
digitalwrite(strobe,high);
}
}
void loop()
{
readmsgeq7();
// display values of left channel on matrix
for( band = 0; band < 8; band++)
{
if (left[band]>=895) { lc.setrow(1, band, 255); } else //this section defines how many leds in column light up. defined set row due orientation of matrix. highest value, , lights 8 leds
if (left[band]>=767) { lc.setrow(1, band, 254); } else //7
if (left[band]>=639) { lc.setrow(1, band, 252); } else //6
if (left[band]>=511) { lc.setrow(1, band, 248); } else //5
if (left[band]>=383) { lc.setrow(1, band, 240); } else //4
if (left[band]>=255) { lc.setrow(1, band, 224); } else //3
if (left[band]>=127) { lc.setrow(1, band, 192); } else //2
if (left[band]>=75) { lc.setrow(1, band, 128); } else //1
if (left[band]>=0) { lc.setrow(1, band, 0); } //0
}
// display values of right channel on matrix
for( band = 0; band < 8; band++)
{
if (right[band]>=895) { lc.setrow(0, band, 255); } else //this section defines how many leds in column light up. defined set row due orientation of matrix. highest value, , lights 8 leds
if (right[band]>=767) { lc.setrow(0, band, 254); } else //7
if (right[band]>=639) { lc.setrow(0, band, 252); } else //6
if (right[band]>=511) { lc.setrow(0, band, 248); } else //5
if (right[band]>=383) { lc.setrow(0, band, 240); } else //4
if (right[band]>=255) { lc.setrow(0, band, 224); } else //3
if (right[band]>=127) { lc.setrow(0, band, 192); } else //2
if (right[band]>=75) { lc.setrow(0, band, 128); } else //1
if (right[band]>=0) { lc.setrow(0, band, 0); } //0
}
delay(25);
}
hopefully, can tell, function reads 1 of 8 data values in array, right or left, , outputs row related value in array. data value 0 outputs row 0, value 1 outputs row 1, , on through 8 rows, 0-7. want right matrix take data value 0 , output row 7, value 1 output on row 6, , on, i'm not sure how go it.
would love suggestions try , working.
Arduino Forum > Using Arduino > Programming Questions > Reflecting LED Matrix Display
arduino
Comments
Post a Comment