Hi,
I would like to generate 4 square waves of different frequencies lets say 6hz, 9.5hz, 15hz, 20hz signals.Till now by referring some posts,I was able to generate 3 square waves(30hz) using timers.Please help me get through this.
Here is the code for timers 2,3 (I am using arduino Mega2560)
void setup() {
TCCR2B = TCCR2B & B11111000 | B00000111; // for PWM frequency of 30.6hz
TCCR3B = TCCR3B & B11111000 | B00000101; // for PWM frequency of 30.6hz
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(2,OUTPUT);
}
void loop() {
analogWrite(9,127);
analogWrite(10,127);
analogWrite(2,127);
}