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


Java DigitalModule类代码示例

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


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

示例1: createRelayPacket

import edu.wpi.first.wpilibj.DigitalModule; //导入依赖的package包/类
private static byte [] createRelayPacket(int module) {
		byte [] data = new byte[3 + headerSize];
		generateHeader(data, 0, headerSize, 4);
		data[headerSize] = (byte)(module+1);
		for (int i = 0; i < 8; i++) {
			byte bit = (byte)(DigitalModule.getInstance(module+1).getRelayForward(i+1) ? 1:0);
			if (bit == 0) bit = (byte)(DigitalModule.getInstance(module+1).getRelayReverse(i+1) ? 2:0);
//			byte bit = (byte)new Random().nextInt(3);
			if (bit == 1) {
				data[headerSize+1] ^= 1 << 7 - i;
			} else if (bit == 2) {
				data[headerSize+1] ^= 1 << 7 - i;
				data[headerSize+2] ^= 1 << 7 - i;
			}
		}
		return data;
	}
 
开发者ID:Team-2502,项目名称:RobotCode2014,代码行数:18,代码来源:BlackBoxSubPacket.java

示例2: createDigitalPacket

import edu.wpi.first.wpilibj.DigitalModule; //导入依赖的package包/类
private static byte [] createDigitalPacket(int module) {
	byte [] data = new byte[3 + headerSize];
	generateHeader(data, 0, headerSize, 2);
	data[headerSize] = (byte)(module+1);
	for (int i = 0; i < 14; i++) {
		if (!DigitalModule.getInstance(module+1).getDIO(i)) continue;
		if (i < 8)
			data[headerSize+1] ^= (byte)(1 << (7-i));
		else
			data[headerSize+2] ^= (byte)(1 << 7-(i-8));
	}
	return data;
}
 
开发者ID:Team-2502,项目名称:RobotCode2014,代码行数:14,代码来源:BlackBoxSubPacket.java

示例3: createPWMPacket

import edu.wpi.first.wpilibj.DigitalModule; //导入依赖的package包/类
private static byte [] createPWMPacket(int module) {
		byte [] data = new byte[11 + headerSize];
		generateHeader(data, 0, headerSize, 3);
		data[headerSize] = (byte)(module+1);
		for (int i = 0; i < 10; i++) {
			data[i+headerSize+1] = (byte)DigitalModule.getInstance(module+1).getPWM(i+1);
//			data[i+headerSize+1] = (byte)0x80;
		}
		return data;
	}
 
开发者ID:Team-2502,项目名称:RobotCode2014,代码行数:11,代码来源:BlackBoxSubPacket.java

示例4: init

import edu.wpi.first.wpilibj.DigitalModule; //导入依赖的package包/类
public void init(Environment environment) {
  accel = new ADXL345_I2C(RobotMap.ACCELEROMETER_PORT, ADXL345_I2C.DataFormat_Range.k4G);
  i2c = new I2C(DigitalModule.getInstance(1), DEVICE_ADDRESS);
  i2c.setCompatabilityMode(true);
  timer = new Timer();
  timer.start();
}
 
开发者ID:Impact2585,项目名称:aerbot-champs,代码行数:8,代码来源:AccelerometerSystem.java

示例5: setupCompass

import edu.wpi.first.wpilibj.DigitalModule; //导入依赖的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.DigitalModule; //导入依赖的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.DigitalModule; //导入依赖的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

示例8: SwerveDrive

import edu.wpi.first.wpilibj.DigitalModule; //导入依赖的package包/类
public SwerveDrive() {
    frontRight.setContinuous(RobotMap.CONTINUOUS);
    frontLeft.setContinuous(RobotMap.CONTINUOUS);
    rearRight.setContinuous(RobotMap.CONTINUOUS);
    rearLeft.setContinuous(RobotMap.CONTINUOUS);

    frontRight.setAbsoluteTolerance(RobotMap.TOLERANCE);
    frontLeft.setAbsoluteTolerance(RobotMap.TOLERANCE);
    rearRight.setAbsoluteTolerance(RobotMap.TOLERANCE);
    rearLeft.setAbsoluteTolerance(RobotMap.TOLERANCE);

    frontRight.setInputRange(RobotMap.POTMIN, RobotMap.POTMAX);
    frontLeft.setInputRange(RobotMap.POTMIN, RobotMap.POTMAX);
    rearRight.setInputRange(RobotMap.POTMIN, RobotMap.POTMAX);
    rearLeft.setInputRange(RobotMap.POTMIN, RobotMap.POTMAX);

    frontRight.setOutputRange(-RobotMap.STEERPOW, RobotMap.STEERPOW);
    frontLeft.setOutputRange(-RobotMap.STEERPOW, RobotMap.STEERPOW);
    rearRight.setOutputRange(-RobotMap.STEERPOW, RobotMap.STEERPOW);
    rearLeft.setOutputRange(-RobotMap.STEERPOW, RobotMap.STEERPOW);

    positionFL.start();
    positionFR.start();
    positionRL.start();
    positionRR.start();

    frontLeft.enable();
    frontRight.enable();
    rearLeft.enable();
    rearRight.enable();

    i2c = DigitalModule.getInstance(1).getI2C(0x04 << 1);
    retrieveOffsets();
}
 
开发者ID:FRC-Team-4143,项目名称:SwerveDriveTest,代码行数:35,代码来源:SwerveDrive.java

示例9: Bling

import edu.wpi.first.wpilibj.DigitalModule; //导入依赖的package包/类
public Bling() {
    //DigitalModule::GetI2C(UINT32,address);
    DigitalModule digiMod = DigitalModule.getInstance(1);
    chat = digiMod.getI2C(8);
    
    chat.setCompatabilityMode(true);
}
 
开发者ID:Team3574,项目名称:RKellyBot,代码行数:8,代码来源:Bling.java

示例10: InsightLT

import edu.wpi.first.wpilibj.DigitalModule; //导入依赖的package包/类
public InsightLT(int option)
{
    
    module = DigitalModule.getInstance(1);  
    setupHelper();      
    config(option);
}
 
开发者ID:SaintsRobotics,项目名称:Woodchuck-2013,代码行数:8,代码来源:InsightLT.java

示例11: MessageHandler

import edu.wpi.first.wpilibj.DigitalModule; //导入依赖的package包/类
public MessageHandler() {
    //Get ourselves an i2c instance to send out some data.
    i2c = new I2C(DigitalModule.getInstance(1), 0x52 << 1);
}
 
开发者ID:wildstang111,项目名称:2013_drivebase_proto,代码行数:5,代码来源:WsLED.java


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