コード例 #1
0
ファイル: PWM_lib_example.cpp プロジェクト: V-KING/Arduino
void setup()
{
  //initialize all timers except for 0, to save time keeping functions
  InitTimersSafe(); 

  //sets the frequency for the specified pin
  bool success = SetPinFrequencySafe(led, frequency);
  
  //if the pin frequency was set successfully, turn pin 13 on
  if(success) {
    pinMode(13, OUTPUT);
    digitalWrite(13, HIGH);    
  }
}
コード例 #2
0
ファイル: ATimerDefs.cpp プロジェクト: BitElectronics/SumoBot
//Initializes all timer objects, setting them to modes compatible with frequency manipulation. All timers are set to 488 - 500 Hz at the end of initialization.
void InitTimers()
{
	Timer0_Initialize();
	InitTimersSafe();
}