Skip to content

Sweep a PWM output between two levels over a period

License

Notifications You must be signed in to change notification settings

FirstBuild/pwm-sweeper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

pwm-sweeper

Sweep a PWM output between two levels over a period. The value will sweep between the LOW PWM value and the HIGH PWM value and then back to the LOW value over one period. The variation is linear.

Instructions

  • Download the repo and open it in the Arduino IDE
  • Change the macro definitions for your needs
Macro Use
PWM_PIN The output pin *
PWM_LOW The low value of the duty cycle **
PWM_HIGH The high value of the duty cycle **
PERIOD_SECONDS The period in seconds, e.g. 10 = 10 seconds

* The output pin chosen must be on a pin supported by your board for PWM output. See the Arduino analogWrite reference for more info.

** PWM Value Notes:

  • The value must be between 0.0 and 1.0
  • The value must not be negative
  • PWM_LOW must be less than PWM_HIGH
  • 0.0 = 0% duty cycle
  • 1.0 = 100% duty cycle

About

Sweep a PWM output between two levels over a period

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages