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 / 846
845  |  847
Subject: 
RE: Idea on how to interrupt RotateMotor?
Newsgroups: 
lugnet.robotics.nxt
Date: 
Fri, 3 Aug 2007 02:34:24 GMT
Viewed: 
20310 times
  
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 is in Reply To:
  Idea on how to interrupt RotateMotor?
 
Since there is no event in nxc. Is there anyway to interrupt this call via a Off(OUT_AC) in another task? RotateMotor(OUT_AC, 20, 800); I could have used a time Wait after onFwd. However, This will not allow me to get a more previous degree turning. (...) (17 years ago, 3-Aug-07, to lugnet.robotics.nxt)

2 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