View unanswered posts | View active topics It is currently Thu Aug 21, 2014 8:31 pm






Reply to topic  [ 5 posts ] 
HOW TO VIEW nMotorEncoder VALUE WHILE RUNNING DEBUGGER 
Author Message
Rookie

Joined: Tue Jul 06, 2010 4:48 pm
Posts: 2
Post HOW TO VIEW nMotorEncoder VALUE WHILE RUNNING DEBUGGER
Is it possible to view the number of rotations the motor has traveled during the duration of the program? (like on the NXT Devices window)

We are having problems with our robot and the nMotorEncoder so help would be much appreciated. :breakcomputer: :breakcomputer: :breakcomputer: :breakcomputer: :breakcomputer: :breakcomputer: :cry: :cry: :cry: :cry: :roll: :(


Tue Jul 06, 2010 4:52 pm
Profile
Expert
User avatar

Joined: Mon Oct 06, 2008 6:30 pm
Posts: 176
Location: Netherlands
Post Re: HOW TO VIEW nMotorEncoder VALUE WHILE RUNNING DEBUGGER
You could create a variable and give it the value of the motor encoder periodically. The variable and it's value will show up in the debug window.

_________________
My most recent blog: A grain of sugar


Tue Jul 06, 2010 5:00 pm
Profile WWW
Rookie

Joined: Tue Jul 06, 2010 4:48 pm
Posts: 2
Post Re: HOW TO VIEW nMotorEncoder VALUE WHILE RUNNING DEBUGGER
We are not very experienced with this :poke:

How would you create the variable and assign the nMotorEncoder value to it?


Tue Jul 06, 2010 5:12 pm
Profile
Expert
User avatar

Joined: Mon Oct 06, 2008 6:30 pm
Posts: 176
Location: Netherlands
Post Re: HOW TO VIEW nMotorEncoder VALUE WHILE RUNNING DEBUGGER
Code:
Task view()
{
  // create a variable
  int encoderA;
  // loop forever
  While (true)
  {
    // store the  encoder value
    EncoderA=nMotorEnoder[motorA];
    // wait a bit before starting all over again
    wait1Msec(20);
  }
}



Try this code. You'll have to start this task from the main task using the starttask function.

_________________
My most recent blog: A grain of sugar


Wed Jul 07, 2010 3:14 am
Profile WWW
Creator
Creator

Joined: Fri Feb 09, 2007 9:21 am
Posts: 614
Post Re: HOW TO VIEW nMotorEncoder VALUE WHILE RUNNING DEBUGGER
we_need_help wrote:
Is it possible to view the number of rotations the motor has traveled during the duration of the program? (like on the NXT Devices window)

We are having problems with our robot and the nMotorEncoder so help would be much appreciated. :breakcomputer: :breakcomputer: :breakcomputer: :breakcomputer: :breakcomputer: :breakcomputer: :cry: :cry: :cry: :cry: :roll: :(

What exactly do you mean?

Do you mean be able to view on the PC? if so, just open the "NXT Devices" window whenever you're running the Debugger.

Or do you mean view on the on-board LCD because the PC debugger is not available? if so, use the function "nxtDisplayLine" (I may have the spelling wrong) to periodically write the value of the encoder to the LCD screen.


Fri Aug 20, 2010 4:50 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.