Package lab01

Source Code of lab01.CheckSonicAction

package lab01;

import lejos.nxt.UltrasonicSensor;
import lejos.nxt.SensorPort;

public class CheckSonicAction implements Action {
  private int distance;
 
  public void run() {
    UltrasonicSensor sensor = new UltrasonicSensor(SensorPort.S1);
    distance = sensor.getDistance();   
  }
 
  public Boolean isOk(){
    if (distance < 50){
      return Boolean.FALSE;
    } else {
      return Boolean.TRUE;
    }
  }
}
TOP

Related Classes of lab01.CheckSonicAction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.