Hi Andrew,
I also recently got the lightuino and a spectrum shield in the mail and am attempting a really simple project. Just getting a bunch of LEDs to have their brightness controlled according to the amplitude of the signal in its respective frequency band. Before using the lightuino, I made a smaller version, using only 6 LEDs on an arduino uno. My code for that is here:
int spectrumStrobe = 4;
int spectrumReset = 5;
int spectrumAnalog = A0;
int spectrum[7];
void setup()
{
Serial.begin(9600);
pinMode(spectrumAnalog, INPUT);
pinMode(spectrumReset, OUTPUT);
pinMode(spectrumStrobe, OUTPUT);
analogReference(DEFAULT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
pinMode(6, OUTPUT);
pinMode(5, OUTPUT);
pinMode(3, OUTPUT);
digitalWrite(spectrumReset, LOW);
digitalWrite(spectrumStrobe, HIGH);
}
void loop()
{
digitalWrite(spectrumReset, HIGH);
digitalWrite(spectrumReset, LOW);
for(int i=0; i<7; i++)
{
digitalWrite(spectrumStrobe, HIGH);
digitalWrite(spectrumStrobe, LOW);
Serial.println(analogRead(spectrumAnalog));
delay(3);
spectrum[i] = analogRead(spectrumAnalog) / 4;
}
if(spectrum[0] > 15)
{
analogWrite(11, spectrum[0]);
}
else
{
analogWrite(11, 0);
}
if(spectrum[1] > 18)
{
analogWrite(10, spectrum[1]);
}
else
{
analogWrite(10, 0);
}
if(spectrum[2] > 15)
{
analogWrite(9, spectrum[2]);
}
else
{
analogWrite(9, 0);
}
if(spectrum[3] > 15)
{
analogWrite(6, spectrum[3]);
}
else
{
analogWrite(6, 0);
}
if(spectrum[4] > 15)
{
analogWrite(5, spectrum[4]);
}
else
{
analogWrite(5, 0);
}
if(spectrum[5] > 15)
{
analogWrite(3, spectrum[5]);
}
else
{
analogWrite(3, 0);
}
}
It took me just a few minutes to write this and get this up and running. I am somewhat of a noob, so when I looked at your begin_here code I was completely confused and have since then stared at that code for hours, read forums, etc., and really figured out very little (so I haven't even gotten to the point of trying to hook up the shield yet). To be honest, I am not even really clear on how your code works at all since it was my understanding that you need have a section that is within a loop(){ } for any arduino code to work. Such is the level of my ignorance, and for that I apologize. Would you please send me in the right direction and try to help me find a lightuino solution for the above simple code? The reason why I needed the lightuino is because although I will still only be using 6 frequency bands, I want several LEDs per frequency band, like 8 or something, so needed more outputs.
I think you mentioned that you don't have a spectrum shield, so I don't really need specifics, but basically just need to figure out how to make a sketch where I can input pwm values that give brightnesses for the LEDs. Once I have that, I believe I will be able to get the shield working using similar code to the above and referring to the previous posts about the spectrum shield.
Thanks a lot for your patience with someone as new as me.
Chris