本文整理汇总了Java中lejos.hardware.sensor.EV3UltrasonicSensor类的典型用法代码示例。如果您正苦于以下问题:Java EV3UltrasonicSensor类的具体用法?Java EV3UltrasonicSensor怎么用?Java EV3UltrasonicSensor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EV3UltrasonicSensor类属于lejos.hardware.sensor包,在下文中一共展示了EV3UltrasonicSensor类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: init
import lejos.hardware.sensor.EV3UltrasonicSensor; //导入依赖的package包/类
public static void init() {
GlobalDefinitions.LEFT_MOTOR = new EV3LargeRegulatedMotor(LocalEV3.get().getPort(GlobalDefinitions.leftMotorPort));
GlobalDefinitions.RIGHT_MOTOR = new EV3LargeRegulatedMotor(LocalEV3.get().getPort(GlobalDefinitions.rightMotorPort));
GlobalDefinitions.RELOADMOTOR = new EV3LargeRegulatedMotor(LocalEV3.get().getPort(GlobalDefinitions.reloadMotorPort));
GlobalDefinitions.SHOOTMOTOR = new EV3LargeRegulatedMotor(LocalEV3.get().getPort(GlobalDefinitions.shooterMotorPort));
GlobalDefinitions.LEFT_COLOR_SENSOR = new EV3ColorSensor(LocalEV3.get().getPort(GlobalDefinitions.leftColorSensorPort));
GlobalDefinitions.RIGHT_COLOR_SENSOR = new EV3ColorSensor(LocalEV3.get().getPort(GlobalDefinitions.rightColorSensorPort));
GlobalDefinitions.US_SENSOR = new EV3UltrasonicSensor(LocalEV3.get().getPort(GlobalDefinitions.usSensorPort));
//GlobalDefinitions.REAR_COLOR_SENSOR = new EV3ColorSensor(LocalEV3.get().getPort(GlobalDefinitions.rearColorSensorPort));
}
开发者ID:alisharif2,项目名称:dpm-project,代码行数:11,代码来源:GlobalDefinitions.java
示例2: setupUltrasonicSensor
import lejos.hardware.sensor.EV3UltrasonicSensor; //导入依赖的package包/类
private void setupUltrasonicSensor() {
uSensorMotor = Motor.C;
uSensor = new EV3UltrasonicSensor(ev3.getPort("S3"));
ultrasonicDistSP = uSensor.getDistanceMode();
ultrasonicDistSample = new float[ultrasonicDistSP.sampleSize()];
//uSensorMotor.setAcceleration(200);
//uSensorMotor.setAcceleration(10);;
}
开发者ID:JINKEHE,项目名称:Rescue-Victims,代码行数:9,代码来源:Megatron.java
示例3: initSensor
import lejos.hardware.sensor.EV3UltrasonicSensor; //导入依赖的package包/类
private void initSensor(SensorPort sensorPort, Sensor sensorType, Port hardwarePort) {
if ( sensorType != null && isUsed(sensorType) ) {
this.lcd.clear();
// Hal.formatInfoMessage("Initializing " + sensorType.getComponentType().getShortName() + " on port " + sensorPort + " ...", this.lcd);
switch ( sensorType.getType() ) {
case COLOR:
this.lejosSensors.put(sensorPort, sensorSampleProviders(new EV3ColorSensor(hardwarePort)));
break;
case INFRARED:
this.lejosSensors.put(sensorPort, sensorSampleProviders(new EV3IRSensor(hardwarePort)));
break;
case GYRO:
this.gyroSensor = new EV3GyroSensor(hardwarePort);
this.lejosSensors.put(sensorPort, sensorSampleProviders(this.gyroSensor));
break;
case TOUCH:
this.lejosSensors.put(sensorPort, sensorSampleProviders(new EV3TouchSensor(hardwarePort)));
break;
case ULTRASONIC:
this.lejosSensors.put(sensorPort, sensorSampleProviders(new EV3UltrasonicSensor(hardwarePort)));
break;
case COMPASS_HI_TEC:
this.hiTechnicCompass = new HiTechnicCompass(hardwarePort);
this.lejosSensors.put(sensorPort, sensorSampleProviders(this.hiTechnicCompass));
break;
case SOUND:
this.lejosSensors.put(sensorPort, sensorSampleProviders(new NXTSoundSensor(hardwarePort)));
break;
default:
throw new DbcException("Sensor type " + sensorType.getType() + " does not exists!");
}
}
}
开发者ID:OpenRoberta,项目名称:robertalab-ev3lejos-v0,代码行数:34,代码来源:DeviceHandler.java
示例4: SimpleEV3UltrasonicSensor
import lejos.hardware.sensor.EV3UltrasonicSensor; //导入依赖的package包/类
public SimpleEV3UltrasonicSensor(Port port) {
delegate = new EV3UltrasonicSensor(port);
logger = SensorMonitorFactory.getLogger(port);
// Distance mode
distanceMode = delegate.getDistanceMode();
distanceSample = new float[distanceMode.sampleSize()];
// Listen (presence) mode
listenMode = delegate.getListenMode();
listenSample = new float[listenMode.sampleSize()];
}
开发者ID:jbenech,项目名称:gnikrap,代码行数:11,代码来源:SimpleEV3UltrasonicSensor.java
示例5: setupSensors
import lejos.hardware.sensor.EV3UltrasonicSensor; //导入依赖的package包/类
void setupSensors() {
logger.trace("setupSensors");
leftTouch = new EV3TouchSensor(SensorPort.S1);
rightTouch = new EV3TouchSensor(SensorPort.S4);
distance = new EV3UltrasonicSensor(SensorPort.S2);
distance.enable();
distanceSampler = distance.getDistanceMode();
}
开发者ID:RadicalZephyr,项目名称:ev3java,代码行数:10,代码来源:Main.java
示例6: FilteredUltrasonicSensor
import lejos.hardware.sensor.EV3UltrasonicSensor; //导入依赖的package包/类
public FilteredUltrasonicSensor(EV3UltrasonicSensor usSensor) {
// TODO Auto-generated constructor stub
this.ultrasonicSampleProvider = usSensor.getDistanceMode();
this.ultrasonicData = new float[ultrasonicSampleProvider.sampleSize()];
}
开发者ID:alisharif2,项目名称:dpm-project,代码行数:6,代码来源:FilteredUltrasonicSensor.java
注:本文中的lejos.hardware.sensor.EV3UltrasonicSensor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论