Hi I get an error (in title of post) on line 20 of this code, I am trying to run a light show and need to use an arduino as an interface for the relays to the pc, it was working, however I needed a lower pwm frequency and now i get this error but I cannot figure out what is wrong. What is the problem?
#define CHANNELS_COUNT 8
////////// PWM pin
#define Ch1 2 // PWM Pin 2
#define Ch2 3 // PWM Pin 3
#define Ch3 10 // PWM Pin 4
#define Ch4 5 // PWM Pin 5
#define Ch5 6 // PWM Pin 6
#define Ch6 7 // PWM Pin 7
#define Ch7 8 // PWM Pin 8
#define Ch8 9 // PWM Pin 9
int myEraser = 7;
int myPrescaler = 5;
int Ch[CHANNELS_COUNT] = {Ch1, Ch2, Ch3, Ch4, Ch5, Ch6, Ch7, Ch8};
int incomingByte[CHANNELS_COUNT]; // array to store the values from serial port
TCCR2B &= ~myEraser;
TCCR3B &= ~myEraser;
TCCR4B &= ~myEraser;
TCCR2B |= myPrescaler;
TCCR3B |= myPrescaler;
TCCR4B |= myPrescaler;
void setup()
{
Serial.begin(9600); // set up Serial at 9600 bps
for (byte i=0; i<CHANNELS_COUNT; i++) pinMode(Ch[i], OUTPUT); // declare channel pin as an output
}
void loop() {
if (Serial.available() >= CHANNELS_COUNT) {
for (int i=0; i<CHANNELS_COUNT; i++) {
incomingByte[i] = Serial.read(); // read each byte
if (i<12) { //arduino mega consists of 12 PWM
analogWrite(Ch[i], 255 - incomingByte[i]); // Write current values to LED pins
} else {
digitalWrite (Ch[i], incomingByte[i]); // Write the Digital Output to the LED pin.
}
}
}
}