Subject:
|
Re: RotateMotorEx hangs
|
Newsgroups:
|
lugnet.robotics.nxt
|
Date:
|
Wed, 8 Aug 2007 05:53:45 GMT
|
Viewed:
|
22560 times
|
| |
| |
In lugnet.robotics.nxt, Elizabeth Mabrey wrote:
> Subject: RE: Idea on how to interrupt RotateMotor?
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 revolutions at most; return immediately
// motor regulator is running its own thread
while(Motor.A.isMoving() && eye.readValue()>40);// wait for dark or 10 revs
Motor.A.stop();
LCD.drawInt(Motor.A.getTachoCount(),0,1);//how many degrees before it quit?
LCD.refresh();
-Roger
|
|
Message has 1 Reply: | | Re: RotateMotorEx hangs
|
| (...) <snipped> The RotateMotor call is designed to block. If you don't want to block then you can write code almost exactly like what Roger wrote in Java using other NXC API calls. Like so: #define UF_TLSM UF_UPDATE_TACHO_LIMI...PDATE_MODE #define (...) (17 years ago, 8-Aug-07, to lugnet.robotics.nxt)
|
Message is in Reply To:
| | RotateMotorEx hangs
|
| 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...ugnet.com] On Behalf Of Elizabeth Mabrey Sent: Thursday, August (...) (17 years ago, 3-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
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
Active threads in NXT programmable brick
|
|
|
|