Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ATmega128 #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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