Created
February 14, 2010 17:53
-
-
Save JoshAshby/304151 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int pwm_ramp(unsigned int value, int pin, unsigned int speed) | |
{ | |
if (value < pwm_value) { | |
if (pin == 0) { | |
unsigned int i; | |
for (i=pwm_value; i>=value; i-= speed) { | |
OCR1AL = i; | |
pwm_value = i; | |
} | |
} | |
} else { | |
if (pin == 0) { | |
unsigned int i; | |
for (i=0; i<=value; i+= speed) { | |
OCR1AL = i; | |
pwm_value = i; | |
} | |
} | |
} | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment