Re:I2C Address

This is where you talk about the NXJ hardware related topics such as the brick, sensors, LEGO pieces, etc.

Moderators: roger, imaqine, 99jonathan

New User
Posts: 1
Joined: Fri Nov 13, 2009 6:35 am

Re:I2C Address

Postby ydx05sh » Fri Nov 13, 2009 6:59 am

I have 2 new sensor modules :oops: with I2C interface .The first one has a mcp3421 with adddress 1101000,the other uses a chip MMC21xM with address 0110000.Is it possible for NXT to communicate with them?Thanks!

User avatar
leJOS Team Member
Posts: 4934
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby gloomyandy » Fri Nov 13, 2009 9:10 am

Yes that should be fine. You wil have to set the address of the module before trying to talk to it using setAddress, you may also need to set the operating mode of the sensor to STANDARD_MODE (the default is LEGO_MODE), you do this by passing the mode into the constructor for the I2CSensor class.

If the sensor does not seem to work then try using the address divided by 2, leJOS uses 7 bit I2C addresses but some devices specify the address as an 8 bit value and to convert you need to shift the 8 bit address right by 1 bit (divide by 2)....


Return to “NXJ Hardware”

Who is online

Users browsing this forum: No registered users and 2 guests