stamp.util.os.Event
bxgirten
Posts: 79
Was the Event class removed from the stamp.util.os package? I was playing with JBotInterface and the compiler couldn't resolve the reference.
Comments
Sure it isn't from another package?
regards peter
package JBot;
import stamp.core.*;
import stamp.util.os.*;
/**
* J-Bot wheel control interface
* <p>
* Defines methods that J-Bot wheel control classes must provide.
*
* @version 2.1 03/12/03 Use new Task status support
* @version 2.0 12/12/02 Use Event synchronization
* @version 1.0 10/2/02
* @author Parallax Inc.
*/
public abstract class JBotInterface {
protected Event startEvent ;
protected Event nextEvent = Event.nullEvent ;
protected Event oneTimeEvent = Event.nullEvent ;
static final public int continuousForward = 32760 ;
static final public int continuousBackward = -32760 ;
static final public int continuousLeft = continuousForward ;
static final public int continuousRight = continuousBackward ;
/**
* Set Event that is to be notified when a movement starts.
*
* @param event Event to be notified when movement starts. Can be null.
*/
public JBotInterface ( Event event ) {
startEvent = Event.checkEvent(event);
}
/**
* Setup (current) task to wait for end of movement
*
* @param state next task state
*/
public void wait ( int state ) {
Task waitingTask = Task.getCurrentTask () ;
waitingTask.nextState ( state ) ;
if ( waitingTask.taskStatus()==Task.taskRunning) {
waitingTask.suspend () ;
oneTimeEvent = waitingTask ;
}
}
/**
* Set event to notify when movement is started. May be null.
*
* @param event Event to notify when movement is started
*
* @returns prior event
*/
public Event setStartEvent ( Event event ) {
Event resultEvent = startEvent ;
startEvent = Event.checkEvent(event) ;
return resultEvent ;
}
/**
* Set event to notify when movement is done. May be null.
*
* @param event Event to notify when movement is done
*
* @returns prior event
*/
public Event setNextEvent ( Event event ) {
Event resultEvent = nextEvent ;
nextEvent = Event.checkEvent(event) ;
// Prime the pump if necessary
if ( movementDone ()) {
causeNextEvent () ;
}
return resultEvent ;
}
/**
* Cause one time and next event.
* Normally called by the matching multitasking object.
*/
protected void causeNextEvent () {
// Notify event that the next movement can be started
nextEvent.notify ( this ) ;
// Notify event that the next movement can be started
oneTimeEvent.notify ( this ) ;
oneTimeEvent = Event.nullEvent ;
}
/**
* This method should be called at the beginning of a movement method.
*/
protected void startMovement () {
startEvent.notify (this) ;
}
/**
* Check if movement is done. This should be called until it
* returns true.
*
* @returns true if done waiting for movement
*/
public abstract boolean movementDone () ;
/**
* Stop movement.
*/
public void stop () {
move ( 0 ) ;
}
/**
* Set wheel speed to move forward/backward (negative).
*
* @param inches number of inches to move
*/
public abstract void move ( int inches ) ;
/**
* Set wheel speed to pivot left (positive) or right (negative).
*
* @param steps number of steps to turn
*/
public abstract void pivot ( int steps ) ;
/**
* Turn left (positive) or right (negative).
*
* @param steps number of steps to turn
*/
public abstract void turn ( int steps ) ;
}
http://www.parallax.com/javelin/javelinbot.asp
It says:
JavelinBot robot is a manuscript with Boe-Bot® robot projects designed for use the Javelin Stamp™ module. JavelinBot files (manuscript, program listings, and a revised stamp.util.os package (in the Javelin App Guide) are available for downloading below.
regards peter
-Bill
http://www.parallax.com/javelin/doc/index.html
?
Post Edited (diafysal) : 7/25/2005 10:21:52 PM GMT
Thanks in advance, Peck
It also includes a class SimpleTask (and extended classes FlashLed, CheckPin, CheckPin_and_FlashLed)
which are classes of my own that are much simpler than the Task class.
regards peter