Hi all,
I'm very new to this and am over my head, I hope I can get a little guidance for you folks here.
I need to change the pwm frequency for my Feather MO bluefruit.
The code I have been using works on my UNO but will not compile for the feather.
the error is as reads;
'TCCR1B' was not declared in this scope
I am unsure if I should post the entire code here.
Any help would be great.....be gentle I'm seriously over my head here.
#include <RGBLed.h>
#define REDPIN 9
#define GREENPIN 10
#define BLUEPIN 11
#define FADESPEED 1 // make this higher to slow down
void setup(){
TCCR1B = TCCR1B & B11111000 | B00000001; // Set PWM frequency for D9 & D10:
pinMode(9, OUTPUT); // Sets the pin as output
pinMode(10, OUTPUT); // Sets the pin as output
TCCR2B = TCCR2B & B11111000 | B00000001; // Set PWM for D3 & D11
pinMode(3, OUTPUT); // Sets the pin as output
pinMode(11, OUTPUT); // Sets the pin as output
pinMode(REDPIN, OUTPUT);
pinMode(GREENPIN, OUTPUT);
pinMode(BLUEPIN, OUTPUT);
}
void loop() {
int r, g, b;
// fade from blue to violet
for (r = 0; r < 256; r++) {
analogWrite(REDPIN, r);
delay(FADESPEED);
}
// fade from violet to red
for (b = 255; b > 0; b--) {
analogWrite(BLUEPIN, b);
delay(FADESPEED);
}
// fade from red to yellow
for (g = 0; g < 256; g++) {
analogWrite(GREENPIN, g);
delay(FADESPEED);
}
// fade from yellow to green
for (r = 255; r > 0; r--) {
analogWrite(REDPIN, r);
delay(FADESPEED);
}
// fade from green to teal
for (b = 0; b < 256; b++) {
analogWrite(BLUEPIN, b);
delay(FADESPEED);
}
// fade from teal to blue
for (g = 255; g > 0; g--) {
analogWrite(GREENPIN, g);
delay(FADESPEED);
}
}