Behavior quit program

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: imaqine, 99jonathan, roger

New User
Posts: 22
Joined: Sun Jan 15, 2012 9:24 pm

Behavior quit program

Postby Shadowstep » Thu May 03, 2012 8:50 am

Hay I'm looking for a behavior that could stop my robot from running, so I can pick it up and shut it down by pressing on of the buttons on top of it. I don't really know how I should do that.

Code: Select all

package org.lejos.example;
import lejos.robotics.subsumption.*;
import lejos.nxt.*;

 * Example leJOS Project with an ant build file
public class Stoprunning implements Behavior {
        private boolean suppressed = false;
    public boolean takeControl() {
      return lejos.nxt.Button.ESCAPE.isPressed(); 

    public void action() {

    public void suppress() {
        suppressed = true;

this is what I have now but it does not seem to work.

kind regards

Posts: 381
Joined: Fri Jun 01, 2007 4:31 am
Location: Berkeley, CA

Re: Behavior quit program

Postby roger » Tue May 08, 2012 8:29 pm

I don't immediately see anything wrong with the StopRunning code . What priority does that behavior have? It probably should be the highest.
Can you explain about "does not seem to work"

Return to “NXJ Software”

Who is online

Users browsing this forum: No registered users and 6 guests