Hello good peoples of Arduino: Forum
I, venturing into the vu world have had some sucess. lights turn on. though only when i touch the 1/4 ich jack with my fingers.. when its is plugged into an amp playing david bowie's Moonage Daydream i get nothing.
am using 5 leds to start with. a bread board and an arduino duemilanove.
if you have time and are able to help me to visualise david bowie up in lights on a busy workdesk i'd be very very grateful indeed
kind regards fellow fellows
stephen
here is the code i am using:
// these constants describe the pins. They won't change:
const int soundpin = 5; //reads the power from the light sensor
const int LED1= 2; //LED's 1-5 numbered accordingly
const int LED2= 3;
const int LED3= 4;
const int LED4= 5;
const int LED5= 6;
int sound[4];
int soundav;
void setup()
{
// initialize the serial communications:
Serial.begin(9600);
// Provide ground and power by using the analog inputs as normal
// digital pins. This makes it possible to directly connect the
// breakout board to the Arduino. If you use the normal 5V and
// GND pins on the Arduino, you can remove these lines.
pinMode(soundpin, INPUT);
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
pinMode(LED4, OUTPUT);
pinMode(LED5, OUTPUT);
}
void loop()
{
for(int num=0;num<4;num++)
{
sound[num]=analogRead(soundpin);
if(num==2)
{
soundav=(sound[0]+sound[1]+sound[2]+sound[3])/4;
if((soundav)>50)
{
digitalWrite(LED1,HIGH);
digitalWrite(LED2, HIGH); // set the LED on
digitalWrite(LED3,HIGH);
digitalWrite(LED4, HIGH); // set the LED on
digitalWrite(LED5,HIGH);
}
else if((soundav)>40)
{
digitalWrite(LED1,HIGH);
digitalWrite(LED2, HIGH); // set the LED on
digitalWrite(LED3,HIGH);
digitalWrite(LED4, HIGH); // set the LED on
digitalWrite(LED5,LOW);
}
else if(soundav>30)
{
digitalWrite(LED1,HIGH);
digitalWrite(LED2, HIGH); // set the LED on
digitalWrite(LED3,HIGH);
digitalWrite(LED4, LOW); // set the LED on
digitalWrite(LED5,LOW);
}
else if(soundav>20)
{
digitalWrite(LED1,HIGH);
digitalWrite(LED2, HIGH); // set the LED on
digitalWrite(LED3,LOW);
digitalWrite(LED4, LOW); // set the LED on
digitalWrite(LED5,LOW);
}
else if(soundav>10)
{
digitalWrite(LED1,HIGH);
digitalWrite(LED2, LOW); // set the LED on
digitalWrite(LED3,LOW);
digitalWrite(LED4, LOW); // set the LED on
digitalWrite(LED5,LOW);
}
else
{
digitalWrite(LED1,LOW);
digitalWrite(LED2, LOW); // set the LED on
digitalWrite(LED3,LOW);
digitalWrite(LED4, LOW); // set the LED on
digitalWrite(LED5,LOW);
}
}
}
Serial.print(analogRead(soundpin)); //output for serial monitor
Serial.println(" ");
delay(10);
}