Hi, there
I’m trying to control PWM channels on Navio+ board but it’s not working.
I just want to control a LED using PWM Channel.
when I execute the file, Any Channels doesn’t work on the Navio+ board. (0V)
and the Terminal has displayed “Failed to open device : No such file or directory”.
Please let me know, if somebody know how to solve this problem.
Thanks.
define NAVIO_RCOUTPUT_1 3
define SERVO_MIN 1.250 /mS/
define SERVO_MAX 1.750 /mS/
include "Navio/MPU9250.h"
include "Navio/gpio.h"
include "Navio/PCA9685.h"
using namespace Navio;
//=============================================================================
int main()
{
//-------------------------------------------------------------------------
MPU9250 imu;
imu.initialize();
uint16_t signal = 0;
float ax, ay, az, gx, gy, gz, mx, my, mz;
//-------------------------------------------------------------------------
static const uint8_t outputEnablePin = RPI_GPIO_27;
Pin pin(outputEnablePin);
if (pin.init())
{
pin.setMode(Pin::GpioModeOutput);
pin.write(0); /* drive Output Enable low */
fprintf(stderr, "Output Enable");
}
else
{
fprintf(stderr, "Output Enable not set. Are you root?");
}
PCA9685 pwm;
pwm.initialize();
uint16_t R = 0;
pwm.setPWM(0, R);
while(1)
{
for (R = 0; R < 4095; R++)
pwm.setPWM(0, R);
for (R = 4095; R > 0; R--)
pwm.setPWM(0, R);
}
/*
while(1) {
imu.getMotion9(&ax, &ay, &az, &gx, &gy, &gz, &mx, &my, &mz);
//printf("Acc: %+05.3f %+05.3f %+05.3f ", ax, ay, az);
printf("Gyr: %+05.3f %+05.3f %+05.3f \n", gx, gy, gz);
//printf("Mag: %+05.3f %+05.3f %+05.3f\n", mx, my, mz);
sleep(0.5);
pin.write(1);
//printf("%d", imu.testConnection());
}
*/
return 0;
}