Private
Public Access
2
0
Files
mraa/examples/cycle-pwm3.cpp
Thomas Ingleby fbd863ca39 pwm: Fully Functional.
* C++ example included

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
2014-04-14 16:55:19 +01:00

25 lines
321 B
C++

#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;
}