View Single Post
  #4   Spotlight this post!  
Unread 04-12-2004, 23:29
Mike's Avatar
Mike Mike is offline
has common ground with Matt Krass
AKA: Mike Sorrenti
FRC #0237 (Sie-H2O-Bots (See-Hoe-Bots) [T.R.I.B.E.])
Team Role: Programmer
 
Join Date: Dec 2004
Rookie Year: 2004
Location: Watertown, CT
Posts: 1,003
Mike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond repute
Re: Please Help: Programming the Robovation Kit

Quote:
Originally Posted by wmurphy
to make the robot say go forward / backward / left / right, that would be a tremendous help.
Hey, I just started myself the other day.
If you look on your processor, theres like 10 PWM Outputs, thats where you plug your motors into.
To drive your bot, it'd be something like this (Default Routine function in user_routines.c)
Code:
void Default_Routine(void)
{
  
   pwm01 = 255; // Motor on PWM Output 1 go forward full thrust
   pwm02 = 0; // Motor on PWM Output 2 go reverse full thrust
   pwm03 = 127 // Motor on Pwm Output 3 neutral

}
To make your coding a little easier to read, in user_routines.h you can use #define like so
Code:
/* Used in limit switch routines in user_routines.c */
#define OPEN        1     /* Limit switch is open (input is floating high). */
#define CLOSED      0     /* Limit switch is closed (input connected to ground). */

// I edited from here
#define LeftMotor	pwm01
#define RightMotor	pwm02
#define FrontMotor	pwm03
// to here
and then your code in user_routines.c would be
Code:
void Default_Routine(void)
{
  
   RightMotor = 255; // Motor on PWM Output 1 go forward full thrust
   LeftMotor = 0; // Motor on PWM Output 2 go reverse full thrust
   FrontMotor = 127 // Motor on Pwm Output 3 neutral

}

Hopefully I helped,
__________________
http://www.mikesorrenti.com/