View Single Post
  #1   Spotlight this post!  
Unread 18-01-2011, 08:46
Techwiz's Avatar
Techwiz Techwiz is offline
Blake B
AKA: Blake
FRC #4909 (The Bionics)
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 2007
Location: Massachusetts
Posts: 85
Techwiz will become famous soon enough
Using the NXT Light Sensor.

Does anyone know how to get data from NXT sensors VIA I2C?

We hooked a light sensor to the I2C port on the Digital Side Car, and the red LED illuminated.

In Java:
Code:
byte[] byte1 = new byte[100];
ls.read(0, 7,  byte1);


for(int i= 0; i < 100; i++)
System.out.println(byte1[i]);
Note: Ls is defined as an I2C in the Constructor:
Code:
four = new DigitalModule(4);
ls=new I2C(four,0);
Thanks,
__________________
Blake
Electrical, Programming and Design

Creator FRC Q&A 2017
Mass FRC Team 4909: The Bionics
Maine FRC Team 5122: The RobOTies (2014-2015)
Maine FRC Team 2648: Infinite Loop (2008-2011)
Reply With Quote