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,
