Techwiz
18-01-2011, 08:46
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:
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:
four = new DigitalModule(4);
ls=new I2C(four,0);
Thanks,
We hooked a light sensor to the I2C port on the Digital Side Car, and the red LED illuminated.
In Java:
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:
four = new DigitalModule(4);
ls=new I2C(four,0);
Thanks,