Announcement

Collapse

Technology Forum Has Moved!

The FIRST Tech Challenge Technology forum has moved to a new location! Please take a look at our forum blog for links and instructions on how to access the new forum.

The official blog of the FIRST Tech Challenge - a STEM robotics programs for students grades 7-12.


Note that volunteers (except for FTA/WTA/CSA will still access their role specific forum through this site. The blog also outlines how to access the volunteer forums.
See more
See less

I2C With REV Module

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • I2C With REV Module

    My code always fails to run because the configuration option for I2C devices in the REV module is I2C Device(Synchronous), and there is no option for just I2C Device. In the SDK, I2CDeviceSynch is just a reading interface. This doesn't really make much sense to me. Has anyone gotten I2C to work with the FTC SDK 3.1?

    Code:

    Code:
     
       public class PixyTest extends LinearOpMode {       I2cDevice pixy;       I2cDeviceSynch pixyReader;       I2cAddr pixyAddress = I2cAddr.create7bit(0x54);       byte[] readCache;     @Override     public void runOpMode() throws InterruptedException {        pixy = hardwareMap.i2cDevice.get("pixy");        pixyReader = new I2cDeviceSynchImpl(pixy, pixyAddress, false);        pixyReader.engage();         waitForStart();         while(opModeIsActive()) {            readCache = pixyReader.read(0x54, 100);             telemetry.addData("1", readCache[1]);            telemetry.addData("2", readCache[2]);            telemetry.addData("6", readCache[6]);            telemetry.addData("7", readCache[7]);            telemetry.addData("8", readCache[8]);            telemetry.addData("9", readCache[9]);            telemetry.addData("isInReadMode", pixy.isI2cPortInReadMode());            telemetry.update();        }    } }
Working...
X
😀
🥰
🤢
😎
😡
👍
👎