Thanks Rob!
My question now, though, is how to combine the two following sketches to instruct the circuit to work the way you and I are describing. The second sketch is an example from the bildr.org site and I am showing you because I have never used a MOSFET component before and this is the best way I can describe to you my intentions..
SKETCH1:
const int Xdata = A0;
const int greenPin1 = 2;
const int greenPin2 = 3;
const int greenPin3 = 4;
const int greenPin4 = 5;
const int greenPin5 = 6;
const int greenPin6 = 7;
const int greenPin7 = 8;
const int greenPin8 = 9;
const int greenPin9 = 10;
int sensorValue = 0;
int outputValue = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
sensorValue = analogRead(Xdata);
outputValue = map(sensorValue, 0, 525, 0, 654);
analogWrite(greenPin1, outputValue);
analogWrite(greenPin2, outputValue);
analogWrite(greenPin3, outputValue);
analogWrite(greenPin4, outputValue);
analogWrite(greenPin5, outputValue);
analogWrite(greenPin6, outputValue);
analogWrite(greenPin7, outputValue);
analogWrite(greenPin8, outputValue);
analogWrite(greenPin9, outputValue);
Serial.print("sensor = " );
Serial.println(sensorValue);
Serial.print("\t output = ");
Serial.println(outputValue);
delay(50);
}
SKETCH2:
#define fadePin 3
void setup(){
pinMode(fadePin, OUTPUT);
}
void loop(){
for(int i = 0; i<360; i++){
//convert 0-360 angle to radian (needed for sin function)
float rad = DEG_TO_RAD * i;
//calculate sin of angle as number between 0 and 255
int sinOut = constrain((sin(rad) * 128) + 128, 0, 255);
analogWrite(fadePin, sinOut);
delay(15);
}
}
Thanks for your input!