Laser Spyrograph Pt. 2 (or 4,789,921)

Hey all,
I know you love my requests ;-p...this time i think i've got a pretty good stumper...anyways here it goes

(for those who are just coming in the middle, here's a catch up http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1231205087/56#56)

This is the fan setup with the board above it

The arduino all wired up

This is the back view to show the mirrors and laser

This is the finished product in all its glory with power & USB coming out

This is the designs it makes :smiley:

All that being said, here's the next step...beat interaction :smiley:

All of this section is from a previous project

I have the following program:
Http://www.steelnerve.com/arduinoledaudio.exe

Which monitors the computer "internal mic" and processes the beats it "hears"

Then this code snippet uploaded to the arduino and it implements what the program above sends

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); 
    }
  } 
}

End previous project reference

So as you can see i have software to interpret music, and i have a code that outputs to 3 seperate pins...now i just need it to do that and change the fan speeds...i know the program says RGB but i can ignore that and think "fan1 fan2 fan3"

my current code that is on the arduino, which interprets the potentiometers and sends their data to the transistor which in turn powers the fans is as follows:

int fanA= 3;
int fanB = 5;
int fanC= 6;


int fanaVal = 0;
int fanbVal = 0;
int fancVal = 0;
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);
}

I think this sums it up pretty well...if it doesn't please ask any questions you have

bottom line is, since i'm not too great at coding, but am learning a lot in my C++ class...is can someone please help me tie all of this together so that I have a code to upload from the board that pretty much works like this

if pots at >0
then use the information coming from pots
if pots 0>
then use interpretation from computer

so the point is that turning the pots will give manual control but setting them to zero will give computer control(or whatever way necessary to achieve that effect)

sorry to be so long, hope this outlines my request well

take care!!