programming motor question

when using the setmotor command, you use values from 0 to 255, with 0 being counterclockwise, 255 clockwise, and 127 stationary. Do these values correspond to motor speed?

I’m a little confused, because in some of the sample programs they say //setting motor to starting position // and then they set it’s speed to something…doesn’t that mean it will keep moving constantly in that speed?

one last thing…how long does the setmotor command last? does it continue forever or does it stop eventually?

thanks

move constantly, until you put a

    Motor (1,250) //Set motor forward or counter clock wise
    wait (? ms) 
    motor (1,127) //set motor to stop

you use this to control continuis rotation time

ok that makes sense, thank you…so if in the beginning of a program it says setmotor(1,250) then the motor will lets say open a grabbing mechanism constantly to its max?

also, I was looking at the sample program for an arm/grabber mechanism, and the code kinda accelerated the motors…it set it to increase speed in increments…what is the benefit to doing this? why not just set the motors to max speed?

ok see this:


#include “userapi.h”

int bumper;

void main (void)
{
bumper = GetDigitalInput (1);
if (bumper == 1)
{
Arcade2 (0,1,2,1,2,0,0);
}
Else
{
SetMotor (1,0);
SetMotor (2,255);
wait (1000);
SetMotor (1,127);
SetMotor (2,127);
}
}
}

Sorry I typed 250, it is 255 max it increases speed

#include “userapi.h”

int bumper;

void main (void)
{
bumper = GetDigitalInput (1);
if (bumper == 1)
{
Arcade2 (0,1,2,1,2,0,0);
}
Else
{
SetMotor (1,0);
SetMotor (2,255);
wait (1000);
SetMotor (1,127);
SetMotor (2,127); // Right after, the program goes to remote controller
}
}
}

well i know that, thats the simple autonomous bumper program that is in the inventors guide…but that doesn’t answer my question. With easyc v2 it comes with a ball gatherer 2 sample program…and it increases the speeds of the motors in increments. but in that program you just sent it just sets the motor to the max speed. my question is, what is the benefit of increasing the speed in increments (besides accelerating slower)

edit: i’m not asking from an easyc perspective or for any help with the actual programming, i’m asking what is the benefit of one method over the other. i’m just using the easyc sample program as an example of one of the methods.

This sample was created for our Robotics Engineering Curriculum.

While it uses motor command its actually for a servo. The program
is incrementing the servo position not changing motor speeds.

As far as varying motor speeds vs running full speed 100% of the time.
You ever seen someone drive with the gas fully depressed then coast then
jam the gas again?