当前位置: 首页>>代码示例>>Java>>正文


Java I2C.write方法代码示例

本文整理汇总了Java中edu.wpi.first.wpilibj.I2C.write方法的典型用法代码示例。如果您正苦于以下问题:Java I2C.write方法的具体用法?Java I2C.write怎么用?Java I2C.write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.wpi.first.wpilibj.I2C的用法示例。


在下文中一共展示了I2C.write方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: CompassReader

import edu.wpi.first.wpilibj.I2C; //导入方法依赖的package包/类
public CompassReader(VariableStore variables)
{
	m_i2c = new I2C(I2C.Port.kOnboard, deviceAddress);
	m_i2c.write(2, 0);
	m_variables = variables;
	alpha = variables.GetDouble(compassAlphaVariableName, alphaOrig);
	beta = variables.GetDouble(compassBetaVariableName, betaOrig);
}
 
开发者ID:first95,项目名称:FRC2017,代码行数:9,代码来源:CompassReader.java

示例2: ADXL345_I2C_SparkFun

import edu.wpi.first.wpilibj.I2C; //导入方法依赖的package包/类
/**
 * Constructor.
 * @param port The I2C port the accelerometer is attached to
 * @param range The range (+ or -) that the accelerometer will measure.
 */
public ADXL345_I2C_SparkFun(I2C.Port port, Range range) {
	m_i2c = new I2C(port, kAddress);

	// Turn on the measurements
	m_i2c.write(kPowerCtlRegister, kPowerCtl_Measure);

	setRange(range);

	UsageReporting.report(tResourceType.kResourceType_ADXL345, tInstances.kADXL345_I2C);
	LiveWindow.addSensor("ADXL345_I2C", port.getValue(), this);
}
 
开发者ID:bussell,项目名称:SparkFun6Dof,代码行数:17,代码来源:ADXL345_I2C_SparkFun.java

示例3: LIDARLite

import edu.wpi.first.wpilibj.I2C; //导入方法依赖的package包/类
/**
 * Instantiates LIDARLite with given port and update speed
 * 
 * @param port
 * @param updateMillis
 */
public LIDARLite(I2C.Port port, long updateMillis) {
	sensor = new I2C(port, 0x62);

	Timer.delay(1.5);

	// sensor

	SmartDashboard.putBoolean("SensorAddress - false is success", sensor.addressOnly());

	// Configure Sensor. See
	// http://static.garmin.com/pumac/LIDAR_Lite_v3_Operation_Manual_and_Technical_Specifications.pdf

	sensor.write(0x02, 0x80); // Maximum number of acquisitions during
								// measurement
	sensor.write(0x04, 0x08); // Acquisition mode control
	sensor.write(0x1c, 0x00); // Peak detection threshold bypass

	reset();

	new java.util.Timer().schedule(new TimerTask() {
		@Override
		public void run() {
			distance = measureDistance();
			velocity = measureVelocity();
			// System.out.println(distance.getInches()+"
			// "+velocity.getValue());
		}
	}, updateMillis, updateMillis);
}
 
开发者ID:FRC1458,项目名称:turtleshell,代码行数:36,代码来源:LIDARLite.java

示例4: LIDARSerial

import edu.wpi.first.wpilibj.I2C; //导入方法依赖的package包/类
/**
 * Instantiates LIDARLite with given port and update speed
 * 
 * @param port
 * @param updateMillis
 */
public LIDARSerial(I2C.Port port, long updateMillis) {
	sensor = new I2C(port, 0x62);
	
	Timer.delay(1.5);

	// sensor

	SmartDashboard.putBoolean("SensorAddress", sensor.addressOnly());

	// Configure Sensor. See
	// http://static.garmin.com/pumac/LIDAR_Lite_v3_Operation_Manual_and_Technical_Specifications.pdf

	sensor.write(0x02, 0x80); // Maximum number of acquisitions during
								// measurement
	sensor.write(0x04, 0x08); // Acquisition mode control
	sensor.write(0x1c, 0x00); // Peak detection threshold bypass

	reset();

	t = new java.util.Timer();
	t.schedule(new TimerTask() {
		@Override
		public void run() {
			distance = measureDistance();
			velocity = measureVelocity();
			// System.out.println(distance.getInches()+" "+velocity.getValue());
		}
	}, updateMillis, updateMillis);
}
 
开发者ID:FRC1458,项目名称:turtleshell,代码行数:36,代码来源:LIDARSerial.java

示例5: setupCompass

import edu.wpi.first.wpilibj.I2C; //导入方法依赖的package包/类
public void setupCompass() {
    if(clear){
        clear = false;
        cwrite = new I2C(DigitalModule.getInstance(1), 0x3C);
        cread = new I2C(DigitalModule.getInstance(1), 0x3D);

        cwrite.write(0, 88);
        cwrite.write(1, 64);
        cwrite.write(2, 0);
    }
    clear = true;
}
 
开发者ID:DevilTech,项目名称:Robotics2014,代码行数:13,代码来源:GY85_I2C.java

示例6: setupGyro

import edu.wpi.first.wpilibj.I2C; //导入方法依赖的package包/类
public void setupGyro() {
    if(clear){
        clear = false;
        gwrite = new I2C(DigitalModule.getInstance(1), 0xD1);
        gread = new I2C(DigitalModule.getInstance(1), 0xD0);

        gwrite.write(21, Wiring.SAMPLE_RATE);
        gwrite.write(22, 0x1A);
    }
    clear = true;
}
 
开发者ID:DevilTech,项目名称:Robotics2014,代码行数:12,代码来源:GY85_I2C.java

示例7: setupAccel

import edu.wpi.first.wpilibj.I2C; //导入方法依赖的package包/类
public void setupAccel() {
    if(clear){
        clear = false;
        awrite = new I2C(DigitalModule.getInstance(1), 0xA6);
        aread = new I2C(DigitalModule.getInstance(1), 0xA7);

        awrite.write(44, 0x0A);
        awrite.write(45, 0x08);
        awrite.write(49, 0x08);
    }
    clear = true;
}
 
开发者ID:DevilTech,项目名称:Robotics2014,代码行数:13,代码来源:GY85_I2C.java


注:本文中的edu.wpi.first.wpilibj.I2C.write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。