I'm trying to use 4 PWM outputs from the ethernet shield. I want them to be right next to each other for easy modification
Mega's documentation (http://arduino.cc/en/Hacking/PinMapping2560) states that pin 6,7,8,9 are PWM pins, and from what I understand these pins are not used by the Ethernet Shield by default. (according to Arduino Playground - Shield Pin Usage)
However when I run my program (50% duty cycle), only pins 6,7,8 gives me the PWM signals.
I'm using a simple loop to initialize the PWMs using #defined values.
void init()
{
//loop through the pins, set them as output and zero them
for (int i = 0; i < NUM_MOTORS; i++) {
pinMode(MOTOR_PIN_LIST[i], OUTPUT);
analogWrite(MOTOR_PIN_LIST[i], 0);
pinMode(MOTOR_PIN_DIR_LIST[i], OUTPUT);
digitalWrite(MOTOR_PIN_DIR_LIST[i], 0);
}
pinMode(PIN_MOTOR_DISABLE, OUTPUT);
motor_setAll(50, 50, 50, 50); //xxx
}
where the constant array and defines are:
const int NUM_MOTORS = 4;
//Motor pins
typedef enum motor_pin_t {
//PWM pins
PIN_MOTOR_VERT = 6,
PIN_MOTOR_LAT = 7,
PIN_MOTOR_LEFT = 8,
PIN_MOTOR_RIGHT = 9,
//Motor Shutdown Pins
PIN_MOTOR_DISABLE = 18
};
const int MOTOR_PIN_LIST[NUM_MOTORS] = {PIN_MOTOR_VERT, PIN_MOTOR_LAT, PIN_MOTOR_LEFT, PIN_MOTOR_RIGHT};
Any ideas? Thanks for your help in advance.