-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdemo.c
29 lines (29 loc) · 784 Bytes
/
demo.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <stdio.h>
#include <unistd.h>
#include "duoji.h"
int main(){
// mraa_pwm_context pwm0;
float output, duty;
init();
for (float degree = 0; degree < 180;degree = degree + 30){
rotate(pwm0, degree);
usleep(400000);
}
for (float degree = 180; degree >= 0;degree = degree - 30){
rotate(pwm0, degree);
usleep(400000);
}
// duty = 0.925;
// mraa_pwm_write(pwm0, duty);
// output = mraa_pwm_read(pwm0);
// fprintf(stdout, "PWM value is %f\n", output);
// usleep(200000);
// duty = 0.958333;
// mraa_pwm_write(pwm0, duty);
// output = mraa_pwm_read(pwm0);
// fprintf(stdout, "PWM value is %f\n", output);
// usleep(200000);
deinit();
printf("deinit finished");
return 0;
}