本文整理汇总了Java中edu.wpi.first.wpilibj.I2C.Port类的典型用法代码示例。如果您正苦于以下问题:Java Port类的具体用法?Java Port怎么用?Java Port使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Port类属于edu.wpi.first.wpilibj.I2C包,在下文中一共展示了Port类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: TCS34725ColorSensor
import edu.wpi.first.wpilibj.I2C.Port; //导入依赖的package包/类
/**
* Constructor for TCS34725 Color Sensor from Adafruit. Initializes internal data structures and
* opens I2C coms to the device.
*/
TCS34725ColorSensor() {
color_sen = new I2C(Port.kOnboard, I2C_constants.TCS34725_I2C_ADDR);
sensor_initalized = false;
good_data_read = false;
}
开发者ID:RobotCasserole1736,项目名称:CasseroleLib,代码行数:11,代码来源:TCS34725ColorSensor.java
示例2: FrcI2cDevice
import edu.wpi.first.wpilibj.I2C.Port; //导入依赖的package包/类
/**
* Constructor: Creates an instance of the object.
*
* @param instanceName specifies the instance name.
* @param port specifies the I2C port the device is connected to.
* @param devAddress specifies the address of the device on the I2C bus.
*/
public FrcI2cDevice(final String instanceName, Port port, int devAddress)
{
super(instanceName);
if (debugEnabled)
{
dbgTrace = new TrcDbgTrace(moduleName + "." + instanceName, tracingEnabled, traceLevel, msgLevel);
}
device = new I2C(port, devAddress);
}
开发者ID:trc492,项目名称:Frc2017FirstSteamWorks,代码行数:19,代码来源:FrcI2cDevice.java
示例3: pulsedLightLIDAR
import edu.wpi.first.wpilibj.I2C.Port; //导入依赖的package包/类
public pulsedLightLIDAR() {
i2c = new I2C(Port.kMXP, LIDAR_ADDR);
distance = new byte[2];
updater = new java.util.Timer();
}
开发者ID:RobotCasserole1736,项目名称:CasseroleLib,代码行数:6,代码来源:pulsedLightLIDAR.java
示例4: ITG3200
import edu.wpi.first.wpilibj.I2C.Port; //导入依赖的package包/类
/**
* Creates a new ITG-3200 on the specified I2C port and digital interrupt
* port, possibly using the alternate address.
*
* @param port the I2C port the gyro is attached to
* @param interrupt the interrupt port to use
* @param altAddress whether to use the alternate address
*/
public ITG3200(Port port, DigitalSource interrupt, boolean altAddress) {
// Setup the address
if (altAddress) {
address = ALT_ADDRESS;
} else {
address = ADDRESS;
}
i2c = new I2C(port, address);
// Register an interrupt handler
interrupt.requestInterrupts(new InterruptHandlerFunction<Object>() {
@Override
public void interruptFired(int interruptAssertedMask, Object param) {
if (calibrate) {
// If in calibration mode, run the calibration handler
readCalibrationAxes();
} else {
// Otherwise, read the axes normally
readAxes();
}
}
});
// Listen for a falling edge
interrupt.setUpSourceEdge(false, true);
// Write the power management register (ie. clock source)
writePowerManagement();
// Write the filter and full scale register
writeDLPFFullScale();
// Write sample rate divider
writeSampleRateDivider();
// Enable digital interrupt pin
interrupt.enableInterrupts();
// Write interrupt config to gyro
writeInterruptConfig();
// Clear any existing interrupts in case the robot code was restarted
// but the gyro was not
clearInterrupts();
// Calibrate the gyro
calibrate(DEFAULT_CALIBRATION_TIME);
}
开发者ID:RobotsByTheC,项目名称:CMonster2015,代码行数:54,代码来源:ITG3200.java
注:本文中的edu.wpi.first.wpilibj.I2C.Port类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论