MindSqualls
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Motors only rotate sometimes when accessed in C#-Timer

2 posters

Go down

Motors only rotate sometimes when accessed in C#-Timer Empty Motors only rotate sometimes when accessed in C#-Timer

Post  lumpiluk Sun Sep 04, 2011 10:43 am

Hi,

MindSqalls is exactly what I've been looking for since some time now and I already programmed a simple remote for my NXT (using Motor.Run(x, 0)), which works great.
Now I've started writing an application to control a time lapse rig for my digital camera. I wrote it so that each motor can rotate independently some degrees every interval. Unfortunately, most of the intervals seem to be skipped and I only hear one short beep from the motors.

I followed the quick start quide, but maybe I missed something?
Basically, what I did, is this:
Code:

NxtBrick brick;

private void Start()
{
    brick = new NxtBrick(NxtCommLinkType.USB, 0);

    brick.MotorA = new NxtMotor();
    brick.MotorB = new NxtMotor();
    brick.MotorC = new NxtMotor();
 
    brick.Connect();

    //start timers
}

private void TimerATick()
{
    brick.MotorA.Run(power, /*some value > 0*/);
}

lumpiluk

Posts : 1
Join date : 2011-09-04

Back to top Go down

Motors only rotate sometimes when accessed in C#-Timer Empty Re: Motors only rotate sometimes when accessed in C#-Timer

Post  Niels Tue Sep 06, 2011 8:11 am

I suspect that you are attempting to send the commands to the NXT far too quickly for it process them.

If a command is sent before the previous has run to the end, the new command interrupts the previous. The commands are not queued in the NXT.

Niels

Posts : 19
Join date : 2011-07-15

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum