by Sazabi » Sat Feb 06, 2010 12:05 am
by Sazabi
Sat Feb 06, 2010 12:05 am
That's me again)
I did everything I could imagine,but couldn't make servo move(
That's the code I used:
- Code: Select all
#include "stdafx.h"
#include "rcservo.h"
#include "roboard.h"
int _tmain(int argc, _TCHAR* argv[])
{
if (rcservo_Initialize(RCSERVO_USECHANNEL0))
{
printf("Channels 0 initialized");
rcservo_EnterCaptureMode();
rcservo_SetServo(0, RCSERVO_HITEC_HSR8498);
unsigned long pos = rcservo_ReadPosition(0,0);
unsigned long motion[32]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
motion[1]=2300;
rcservo_EnterPlayMode();
rcservo_SetAction (motion, 500);
while (rcservo_PlayAction() != RCSERVO_PLAYEND)
{
}
rcservo_EnterPWMMode();
unsigned long PWM_period = 10000;
unsigned long PWM_duty = 1700;
unsigned long count = 100;
rcservo_SendPWMPulses(0, PWM_period, PWM_duty, count);
while(!rcservo_IsPWMCompleted(0))
{
}
rcservo_Close();
}
return 0;
}
At the end of this sode I receive this:
channels 0 initialized ( that's programmed by me)
Warning! rcservo_readPositions_PlayMode() fails to read channel 0! (and this appears everytime I try to use PlayMode).
When I try to use RoboRC.exe, it says channels can't be raed. No Idea why.
I use 2 pcs of 7.4V Li-Pos, total of 4Amp/h, HSR8498 does support 7.4V.
What could be the problem?
That's me again)
I did everything I could imagine,but couldn't make servo move(
That's the code I used:
- Code: Select all
#include "stdafx.h"
#include "rcservo.h"
#include "roboard.h"
int _tmain(int argc, _TCHAR* argv[])
{
if (rcservo_Initialize(RCSERVO_USECHANNEL0))
{
printf("Channels 0 initialized");
rcservo_EnterCaptureMode();
rcservo_SetServo(0, RCSERVO_HITEC_HSR8498);
unsigned long pos = rcservo_ReadPosition(0,0);
unsigned long motion[32]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
motion[1]=2300;
rcservo_EnterPlayMode();
rcservo_SetAction (motion, 500);
while (rcservo_PlayAction() != RCSERVO_PLAYEND)
{
}
rcservo_EnterPWMMode();
unsigned long PWM_period = 10000;
unsigned long PWM_duty = 1700;
unsigned long count = 100;
rcservo_SendPWMPulses(0, PWM_period, PWM_duty, count);
while(!rcservo_IsPWMCompleted(0))
{
}
rcservo_Close();
}
return 0;
}
At the end of this sode I receive this:
channels 0 initialized ( that's programmed by me)
Warning! rcservo_readPositions_PlayMode() fails to read channel 0! (and this appears everytime I try to use PlayMode).
When I try to use RoboRC.exe, it says channels can't be raed. No Idea why.
I use 2 pcs of 7.4V Li-Pos, total of 4Amp/h, HSR8498 does support 7.4V.
What could be the problem?