Open nathancheek opened 3 months ago
This PR adds support for the ATmega128.
#include <TimerOne.h> int pwmPinA = TIMER1_A_PIN; int pwmPinB = TIMER1_B_PIN; int pwmPinC = TIMER1_C_PIN; float dutyCycleA = 30.0; float dutyCycleB = 50.0; float dutyCycleC = 70.0; void setup() { Timer1.initialize(40); // 40 us = 25 kHz Timer1.pwm(pwmPinA, (dutyCycleA / 100) * 1023); Timer1.pwm(pwmPinB, (dutyCycleB / 100) * 1023); Timer1.pwm(pwmPinC, (dutyCycleC / 100) * 1023); } void loop() { }
The above program outputs the following waveforms on pins PB5, PB6, and PB7, respectively:
PB5
PB6
PB7
The examples/Interrupt/Interrupt.ino program outputs the following waveform on LED_BUILTIN (PB5):
examples/Interrupt/Interrupt.ino
LED_BUILTIN
This PR adds support for the ATmega128.
PWM Test Program
The above program outputs the following waveforms on pins
PB5
,PB6
, andPB7
, respectively:Interrupt Test Program
The
examples/Interrupt/Interrupt.ino
program outputs the following waveform onLED_BUILTIN
(PB5
):