To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.nxtOpen lugnet.robotics.nxt in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / NXT / 847
846  |  848
Subject: 
RotateMotorEx hangs
Newsgroups: 
lugnet.robotics.nxt
Date: 
Fri, 3 Aug 2007 10:34:53 GMT
Viewed: 
20584 times
  
This is actually the topic about interrupting RotateMotor(). I resend with a
more appropriate topic.
--E

-----Original Message-----
From: news-gateway@lugnet.com [mailto:news-gateway@lugnet.com] On Behalf Of
Elizabeth Mabrey
Sent: Thursday, August 02, 2007 10:34 PM
To: lugnet.robotics.nxt@lugnet.com
Subject: RE: Idea on how to interrupt RotateMotor?

Look at the following sample code:
=======================

int shut =0;

task x1()
{
  TextOut(0, LCD_LINE3, "Waiting until it sees dark!...");
  until (Sensor(IN_1)<40);
  shut=1;
  Off(OUT_AC);
}


task x2()
{
   RotateMotorEx(OUT_AC, 75, 360, 0, FALSE, TRUE);
   TextOut(0, LCD_LINE3, "STOPPED!...");
}

task main()
{
   SetSensorLight(IN_1);
   ClearSensor(IN_1);
   Wait(100);
   start x2;
   start x1;
}

/*------  Big problem!.................
Although the motor does indeed stop turning, the call RotateMotorEx hangs. I
guess it is due to the encoder never
gets to reach 360!?
After the motor got shutoff by the task x1(), shouldn't the RotateMotorEx
simply returns right after the motor is stopped? After it returns, I should
be able to still get the rotation count so that I can make more accurate
decision making.
----*/


--E



Message has 2 Replies:
  Re: RotateMotorEx hangs
 
(...) When you call RotateMotorXXX here is the code that is executed: subroutine __RotateMotor0 brtst EQ, __rotate_Done0, __rotate_angle0 sign __rotate_thePower0, __rotate_angle0 abs __rotate_theAngle0, __rotate_angle0 mul __rotate_thePower0, (...) (17 years ago, 3-Aug-07, to lugnet.robotics.nxt)
  Re: RotateMotorEx hangs
 
(...) Hi Elizabeth: Here is how you could do it in Java: LightSensor eye = new LightSensor(SensorPort.S1); Motor.A.setSpeed(720); // 2 revolutions per second LCD.drawString("wait for dark",0,0); LCD.refresh(): Motor.A.rotate(3600,true); //rotate 10 (...) (17 years ago, 8-Aug-07, to lugnet.robotics.nxt)

8 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR