本文整理汇总了Java中lejos.hardware.port.SensorPort.S2属性的典型用法代码示例。如果您正苦于以下问题:Java SensorPort.S2属性的具体用法?Java SensorPort.S2怎么用?Java SensorPort.S2使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类lejos.hardware.port.SensorPort
的用法示例。
在下文中一共展示了SensorPort.S2属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
public void init(boolean isClockwiseMove) {
this.robotRunning = true;
//Init Motor
motorA = new EV3MediumRegulatedMotor(MotorPort.A);
motorB = new EV3LargeRegulatedMotor(MotorPort.B);
motorC = new EV3LargeRegulatedMotor(MotorPort.C);
// init sensors
this.colorSensor = new EV3ColorSensor(SensorPort.S3);
//For reading color only
try {
this.colorSensorRGB = new EV3ColorSensor(SensorPort.S2);
} catch(Exception e) {
this.colorSensorRGB = null;
}
new Thread(new ColorIdentifyTask()).start();
new Thread(new LightIdentifyTask()).start();
}
示例2: getSensorPort
private static Port getSensorPort(String p) throws EV3ScriptException {
switch (p) {
case "1":
case EV3Constants.S1:
return SensorPort.S1;
case "2":
case EV3Constants.S2:
return SensorPort.S2;
case "3":
case EV3Constants.S3:
return SensorPort.S3;
case "4":
case EV3Constants.S4:
return SensorPort.S4;
}
throw new EV3ScriptException(EV3ScriptException.INVALID_SENSOR_PORT, MapBuilder.buildHashMap("port", p).build());
}
示例3: setupSensors
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();
}
示例4: IRLinkPF_SOM2
public IRLinkPF_SOM2() {
pfIRLink = new NewIRLink(SensorPort.S2);
}
示例5: IRLinkPF_CDM
public IRLinkPF_CDM() {
pfIRLink = new NewIRLink(SensorPort.S2);
}
示例6: IRLinkPF_EM
public IRLinkPF_EM() {
pfIRLink = new NewIRLink(SensorPort.S2);
}
示例7: IRLinkPF_SOM1
public IRLinkPF_SOM1() {
pfIRLink = new NewIRLink(SensorPort.S2);
}
示例8: IRLinkPF_MM
public IRLinkPF_MM() {
pfIRLink = new NewIRLink(SensorPort.S2);
}
示例9: IRLinkPF_CPWMM
public IRLinkPF_CPWMM() {
pfIRLink = new NewIRLink(SensorPort.S2);
}