本文整理汇总了Java中lejos.hardware.sensor.EV3IRSensor类的典型用法代码示例。如果您正苦于以下问题:Java EV3IRSensor类的具体用法?Java EV3IRSensor怎么用?Java EV3IRSensor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EV3IRSensor类属于lejos.hardware.sensor包,在下文中一共展示了EV3IRSensor类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: EV3Helper
import lejos.hardware.sensor.EV3IRSensor; //导入依赖的package包/类
/**
* Instantiates a new helper class and optionally calibrates the cannon.
* Robot is ready for operation after completion.
* @param skipMotorCannonCalibration Set to true if you don't want to calibrate the cannon
*/
public EV3Helper(boolean skipMotorCannonCalibration) {
motorRight = new EV3LargeRegulatedMotor(MotorPort.A);
motorLeft = new EV3LargeRegulatedMotor(MotorPort.B);
//Sets default motor speed for driving motors
motorRight.setSpeed(DEFAULT_MOTOR_SPEED);
motorLeft.setSpeed(DEFAULT_MOTOR_SPEED);
motorCannon = instantiateMotorCannon(skipMotorCannonCalibration);
irSensor = new EV3IRSensor(SensorPort.S1);
colorSensor = new EV3ColorSensor(SensorPort.S4);
rangeSampler = irSensor.getDistanceMode();
lastRange = new float[rangeSampler.sampleSize()];
colors = getColors();
}
开发者ID:magnusbae,项目名称:HelloBrick,代码行数:23,代码来源:EV3Helper.java
示例2: initSensor
import lejos.hardware.sensor.EV3IRSensor; //导入依赖的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
示例3: IRSensor
import lejos.hardware.sensor.EV3IRSensor; //导入依赖的package包/类
public IRSensor() // Constructor initiates the IR Sensor and the sampler we will use to fetch sensor data
{
Port port = LocalEV3.get().getPort("S4"); // Define the port used by the Sensor
SensorModes sensor = new EV3IRSensor(port); // Initiate the EV3 IR Sensor
sampler = sensor.getMode("Distance"); // Define the sampler to be the IRSensor in "Distance" measuring mode
this.setDaemon(true); // Daemonize the sensor thread.
}
开发者ID:abid-mujtaba,项目名称:ev3-BumperCar,代码行数:10,代码来源:IRSensor.java
示例4: SimpleEV3IRSensor
import lejos.hardware.sensor.EV3IRSensor; //导入依赖的package包/类
public SimpleEV3IRSensor(Port port) throws EV3ScriptException {
delegate = new EV3IRSensor(port);
logger = SensorMonitorFactory.getLogger(port);
setChannel(1); // Set default channel
// Distance mode
distanceMode = delegate.getDistanceMode();
distanceSample = new float[distanceMode.sampleSize()];
// Seek mode
seekMode = delegate.getSeekMode();
seekSample = new float[seekMode.sampleSize()];
}
开发者ID:jbenech,项目名称:gnikrap,代码行数:12,代码来源:SimpleEV3IRSensor.java
示例5: createSensor
import lejos.hardware.sensor.EV3IRSensor; //导入依赖的package包/类
private EV3IRSensor createSensor(Port port) {
return new EV3IRSensor(port);
}
开发者ID:jweijers,项目名称:EV3-robots,代码行数:4,代码来源:InfraredSensor.java
示例6: createSensor
import lejos.hardware.sensor.EV3IRSensor; //导入依赖的package包/类
private EV3IRSensor createSensor(Port port) {
System.out.println("Create LeJOS sensor");
return new EV3IRSensor(port.getPort());
}
开发者ID:bdeneuter,项目名称:rx-mindstorms,代码行数:5,代码来源:IRSensor.java
示例7: closeSensor
import lejos.hardware.sensor.EV3IRSensor; //导入依赖的package包/类
private void closeSensor(EV3IRSensor sensor) {
System.out.println("Close LeJOS sensor");
sensor.close();
}
开发者ID:bdeneuter,项目名称:rx-mindstorms,代码行数:5,代码来源:IRSensor.java
示例8: getIrSensor
import lejos.hardware.sensor.EV3IRSensor; //导入依赖的package包/类
public EV3IRSensor getIrSensor() {
return irSensor;
}
开发者ID:magnusbae,项目名称:HelloBrick,代码行数:4,代码来源:EV3Helper.java
注:本文中的lejos.hardware.sensor.EV3IRSensor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论