Skip to content

Conversation

@nathancheek
Copy link

This PR adds support for the ATmega128.

PWM Test Program

#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:

pwm_test

Interrupt Test Program

The examples/Interrupt/Interrupt.ino program outputs the following waveform on LED_BUILTIN (PB5):

interrupt_test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant