Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

I need some urgent help please

Status
Not open for further replies.

impakt

Member level 4
Joined
Dec 19, 2005
Messages
68
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,286
Activity points
1,799
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:
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 );
 }
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.
All I need is an algorithm or an ideea on how to make the robot to turn left or right every 4 or 5 seconds with the speed that I'll specify through that command written in the above code. The MCU of the robot is PIC16F877.
Thank you!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top