This example shows how to dim an LED connected to pin 4 on C
a Led is connected through a 330 resistance to pin 4 on C
(:source:)
#include <Timer.h> #define led_pin WC4
Timers_class Timer; void setup() {
Timer.begin(); Timer.SetPWMOutputPin(led_pin); Timer.setPWMFrequency(1000);//sets the frequency to 1000 hz
}
void loop() { for(int i=255;i>=0;i-=5)
{ Timers.SetPWMDuty(i); if(i==0) { i=255; } delay(30); }
}
(:sourceend:)