Hey all! Thanks to the so many of you that helped me on my first post http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1231205087/0!
It's been 2 years since I completed the project and now I've put it back together cause I'd like to expand upon it. If anyone thinks this is in the wrong section just lemme know!
This is the updated project, I know it's not the prettiest thing in the world but it's easy to troubleshoot.
The wiring is just 3 copies of this diagram plus 3v power to the laser
The code that runs the fans and the pots is
int fanA= 3;
int fanB = 5;
int fanC= 6;
int fanaVal = 100;
int fanbVal = 100;
int fancVal = 100;
int potpinA = 0;
int potpinB = 1;
int potpinC = 2;
char controlChar;
void setup() {}
void loop() {
fanaVal = analogRead(potpinA);
fanbVal = analogRead(potpinB);
fancVal = analogRead(potpinC);
fanaVal = fanaVal / 4;
fanbVal = fanbVal / 4;
fancVal = fancVal / 4;
analogWrite(fanA, fanaVal);
analogWrite(fanB, fanbVal);
analogWrite(fanC,fancVal);
}
The back is simply a switch and 3 pots
And it makes patterns like these on the wall
So now that you have the back story let's get to the question!
I did another project that took three leds(RGB) and beat them to music based on this code
int bluePin = 9;
int redPin = 10;
int greenPin = 11;
// readings from the serial port
int blueVal = 0;
int redVal = 0;
int greenVal = 0;
char controlChar;
void setup() {
analogWrite(redPin, redVal);
analogWrite(greenPin, greenVal);
analogWrite(bluePin, blueVal);
Serial.begin(9600);
}
void loop() {
if (Serial.available() >= 2) {
controlChar = Serial.read();
if (controlChar == 'r') {
redVal = Serial.read();
analogWrite(redPin, redVal);
} else if (controlChar == 'g') {
greenVal = Serial.read();
analogWrite(greenPin, greenVal);
} else if (controlChar == 'b') {
blueVal = Serial.read();
analogWrite(bluePin, blueVal);
}
}
}
And this program
Basically what happened was the program would check the internal mic for whatever music you were playing and interpret the beats. Then it would send that via USB to the board which had the code above on it and the LEDs would change based on the beat.
Sooooo, anyone got any thoughts on how to take that program and those two pieces of code and meld them together so that my 3 fans(which control the spirograph's shapes) are like the RGB leds and I get different patterns based on the beat.
I understand that the fans will have to slow down and speed up so PWM doesn't work as easily on a fan as it does on an LED but maybe it only samples ever few minutes so it keeps the same pattern for the song or something like that.
Any suggestions are always helpful so feel free to take a shot!
Thanks!! -Ray-