Go to Post Once you have reached overkill, more is not useful. - DonRotolo [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Spotlight this post!  
Unread 09-02-2016, 15:31
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: I2C Color Sensor not working

Quote:
Originally Posted by pblankenbaker View Post
Are you using the color sensor found at: http://www.modernroboticsinc.com/color-sensor

If so, it looks like product page indicates that the address of the sensor is 0x3C. Could it be that you just need to change:

Code:
ColorSensor = new I2C(I2C.Port.kOnboard, 0x1E);
To:

Code:
ColorSensor = new I2C(I2C.Port.kOnboard, 0x3C);
I am not familiar with the I2C class in WPILib but it depends on whether the regAddress parameter in the I2C constructor is expecting a 7-bit address or 8-bit address. If it is 8-bit, then 0x3C is the correct address. But if it is expecting a 7-bit address, then it should be 0x1E. In the I2C spec, register address is actually 7 bits, the LSB of the 8-bit address is used to indicate whether it is a READ or WRITE transaction. So a 7-bit address must shift left one-bit to accommodate the READ/WRITE bit. The Modern Robotics Color Sensor spec specifies an 8-bit address. So it's already shifted one bit to the left. But if the WPILib I2C constructor is expecting a 7-bit address (i.e. it will internally shift one bit to the left and OR-in the READ/WRITE bit), then passing 0x1E to it is correct.
I recommend you try both and see which way it is.
__________________
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:19.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi