Created
December 14, 2015 05:01
-
-
Save giacobo1/7d4bbb5fb65b873d55a6 to your computer and use it in GitHub Desktop.
PWM FUNCTION
This file contains hidden or 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
| #include <stdlib.h> | |
| #include <stdio.h> | |
| short PWM1_SET_DUTY( short cont, short q, short MAX ) { | |
| if (cont >=0 && cont < MAX) { | |
| cont += q; | |
| } | |
| return cont; | |
| } | |
| int main(int argc, char * argv[]) { | |
| short cont = 0; | |
| int i = 0; | |
| for (i; i < atoi(argv[1]); i++) { | |
| cont = PWM1_SET_DUTY(cont, 25, 255); | |
| } | |
| printf("%d\n", cont); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment