pwm: Fully Functional.
* C++ example included Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
This commit is contained in:
24
examples/cycle-pwm3.cpp
Normal file
24
examples/cycle-pwm3.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "maa.h"
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
maa::PWM pwm(0, 3);
|
||||
pwm.period_us(200);
|
||||
pwm.enable(1);
|
||||
|
||||
float value = 0.0f;
|
||||
|
||||
while(1) {
|
||||
value = value + 0.01f;
|
||||
pwm.write(value);
|
||||
usleep(50000);
|
||||
if (value >= 1.0f) {
|
||||
value = 0.0f;
|
||||
}
|
||||
float output = pwm.read();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user