marsman
09-04-2009, 06:04 AM
Hi,
thanks to kboyd's fabulous tutorials I was finally able to get my RoBoard started with an Ubutu 9.04 Linux system. The graphic card and LAN network adapter work well. I can't really complain about the boot time (like discussed in another thread), this is ok.
Now, I wanted to toggle some PWM lines. Using the 1.5b RoBoIO library that should be easy but I seem not to be able to get past the initialization of the board. Below is my simple code. Can someone help if I am doing anything wrong?
Note: this code comiles & links with no errors. It can be executed under linux with no errors but it terminates with TF= false which means the rcservo_Initialization() failed. Any thoughts?
#include <iostream>
#include "roboard.h"
int main(void)
{
unsigned long PWM_period = 10000; // 10000us
unsigned long PWM_duty = 1500; // 1500us
unsigned long count = 100;
int channel=0;
bool TF;
std::cout << "get ready:" << std::endl;
TF=rcservo_Initialize(RCSERVO_USECHANNEL0);
if (TF)
{
std::cout << "init done: " << TF << std::endl;
rcservo_EnterPWMMode();
rcservo_SendPWMPulses(channel, PWM_period, PWM_duty, count);
while (!rcservo_IsPWMCompleted(channel))
{
std::cout << "waiting ...." << std::endl;
}
}
else
{
std::cout << "init failed: " << TF << std::endl;
}
rcservo_Close();
std::cout << "Done" << std::endl;
}
thanks to kboyd's fabulous tutorials I was finally able to get my RoBoard started with an Ubutu 9.04 Linux system. The graphic card and LAN network adapter work well. I can't really complain about the boot time (like discussed in another thread), this is ok.
Now, I wanted to toggle some PWM lines. Using the 1.5b RoBoIO library that should be easy but I seem not to be able to get past the initialization of the board. Below is my simple code. Can someone help if I am doing anything wrong?
Note: this code comiles & links with no errors. It can be executed under linux with no errors but it terminates with TF= false which means the rcservo_Initialization() failed. Any thoughts?
#include <iostream>
#include "roboard.h"
int main(void)
{
unsigned long PWM_period = 10000; // 10000us
unsigned long PWM_duty = 1500; // 1500us
unsigned long count = 100;
int channel=0;
bool TF;
std::cout << "get ready:" << std::endl;
TF=rcservo_Initialize(RCSERVO_USECHANNEL0);
if (TF)
{
std::cout << "init done: " << TF << std::endl;
rcservo_EnterPWMMode();
rcservo_SendPWMPulses(channel, PWM_period, PWM_duty, count);
while (!rcservo_IsPWMCompleted(channel))
{
std::cout << "waiting ...." << std::endl;
}
}
else
{
std::cout << "init failed: " << TF << std::endl;
}
rcservo_Close();
std::cout << "Done" << std::endl;
}