impakt
Member level 4

I'm trying to make a scenario where a robot, called Hemisson (www.k-team.com), will walk through a specific route and using an ultrasonic sensor it will detect weather an object has changed it's position or not. If it detects a change than it sends through serial port a message to hyperterminal announcing me that. Now I'm building the route that it should walk but I'm stuck. Can you give an ideea on how to do this? This is some of the code, tho one that I'm interested:
Now to better understand, on the hyperterminal, I give a command and the robot executes it. That's what I'm trying to do...give a command and the robot executes my scenario. And to do that I'm writting the code based upon a specific command: D, __PwmMotLeft, __PwmMotRight. In my command, the two motors have the same speed. Thank yo!!!
Code:
#separate
__C()
{
unsigned char __i;
signed int8 __lMot;
signed int8 __rMot;
// validate minimum length
if( __SerialCounter < 3 )
{
__invalid(); // error
return;
}
if( __SerialBuffer[2] == '-' )
{
__lMot=__rmot= -a2d(__SerialBuffer[3], 10); // reverse
}
else
{
__lMot=__rmot= a2d(__SerialBuffer[2], 10); // forward
}
if( (__lMot < -9) || (__lMot > 9) )
{
__invalid(); // error
return;
}
__PwmMotLeft = __lMot;
__PwmMotRight = __rMot;
printf( "c,%d", __PwmMotRight );
}