I need help driving motors

// Define the number of samples to keep track of. The higher the number, the
// more the readings will be smoothed, but the slower the output will respond to
// the input. Using a constant rather than a normal variable lets us use this
// value to determine the size of the readings array.
const int numReadings = 10;
const int numChannels = 4;
const int INPUTS = 4;
const byte inputPin[INPUTS] = { A0, A1, A2, A3 };

int readings[numChannels][numReadings]; // the readings from the analog input

int index; // the index of the current reading

int total; // the running total
int total1;
int total2; // the running total
int total3;
int total4; // the running total

int average;
int average1;
int average2;
int average3;
int average4;

// the running total

const int analogOutPin = 9;
const int analogOutPin1 = 10;
const int analogOutPin2 = 11;
const int analogOutPin3 = 12;
const int analogOutPin4 = 13;

int sensorValue = 0; // value read from the pot
int outputValue = 0;

int sensorValue1 = 0;
int outputValue1 = 0;

int sensorValue2 = 0; // value read from the pot
int outputValue2 = 0;

int sensorValue3 = 0;
int outputValue3 = 0;

int sensorValue4 = 0;
int outputValue4 = 0;

void setup(){

// initialize serial communication with computer:
Serial.begin(9600);

}

void loop() {
total = total - readings[0][index];
// read from the sensor:
readings[0][index] = analogRead(inputPin[0]); //Index Finger
// add the reading to the total:
total = total + readings[0][index];
// advance to the next position in the array:
index = index + 1;

total1 = total1 - readings[1][index];
// read from the sensor:
readings[1][index] = analogRead(inputPin[1]); //Middle Finger
// add the reading to the total:
total1 = total1 + readings[1][index];
// advance to the next position in the array:
index = index + 1;

total2 = total2 - readings[2][index];
// read from the sensor:
readings[2][index] = analogRead(inputPin[2]); //Ring/Pinky Finger
// add the reading to the total:
total2 = total2 + readings[2][index];
// advance to the next position in the array:
index = index + 1;

// if we're at the end of the array...
if (index >= numReadings) {
// ...wrap around to the beginning:
index = 0;
}

average = total/numReadings;
outputValue = map(average, 290, 350, 0, 180); // First Average
analogWrite(analogOutPin, outputValue);

average1 = total1/numReadings;
outputValue1 = map(average1, 0, 1023, 0, 180); // Second Average
analogWrite(analogOutPin1, outputValue1);

average2 = total2/numReadings;
outputValue2 = map(average2, 0, 360, 0, 180
); // Third Average
analogWrite(analogOutPin2, outputValue2);

Serial.print("Index = ");
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(outputValue);
Serial.println(average);

Serial.print("Middle = ");
Serial.print(sensorValue1);
Serial.print("\t output1 = ");
Serial.println(outputValue1);
Serial.println(average1);

Serial.print("Ring = ");
Serial.print(sensorValue2);
Serial.print("\t output2 = ");
Serial.println(outputValue2);
Serial.println(average2);
delay(50);

The code I have functions well. It takes analog inputs from flex sensors and then creates a PWM using analogWrite. This code however is being implemented and used in a micro. I am having trouble interfacing this PWM with a separate Uno so that I can use servos attached to a motor shield. For my project using two separate arduinos is required, using one is simply not an option unfortunately. Can anyone give me ideas of how to write a code for an arduino that will allow me to control motors with what I've got?

Use a mega

bryang078:
Can anyone give me ideas of how to write a code for an arduino that will allow me to control motors with what I've got?

Not without knowing what you actually have.

And when posting code, please use code tags to make it readable, as is outlined in the "How to use this forum" sticky that's prominently in bold face at the top of the forum (which you should have but probably didn't actually read).