|
Page 1 of 1
|
[ 7 posts ] |
|
| Author |
Message |
|
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 510 Location: Totally not spying on Hassenplug to see what he has for the Brickworld Chicago 2013 sumo contest.
|
 Help with I2C
I'm trying to figure out some of the I2C stuff. So, say I want to send 0x04 to the register 0xfe on the address 0x53 on a sensor that's plugged into port 1. How would that be accomplished? Well, at least I think that's what I want to figure out. Is that what this code does? If not, then what does it do? Also, how to receive? If I send 0x00 to address 0x52, and it sends back 6 bytes, how do I read that? Thanks,
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
| Tue Oct 02, 2012 1:06 pm |
|
 |
|
mightor
Moderator
Joined: Wed Mar 05, 2008 8:14 am Posts: 2864 Location: Rotterdam, The Netherlands
|
 Re: Help with I2C
This looks like Arduino to me, not ROBOTC. If you want a tutorial on I2C, you can find one on my site: http://botbench.com/blog/2009/11/08/rob ... to-part-i/- Xander
_________________| Some people, when confronted with a problem, think, "I know, I'll use threads," | and then two they hav erpoblesms. (@nedbat)| My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
| Tue Oct 02, 2012 1:55 pm |
|
 |
|
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 510 Location: Totally not spying on Hassenplug to see what he has for the Brickworld Chicago 2013 sumo contest.
|
 Re: Help with I2C
Yes, the code I pasted in is Arduino. I want to translate that code to RobotC. I didn't know about your article, will check it out.
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
| Tue Oct 02, 2012 1:58 pm |
|
 |
|
mightor
Moderator
Joined: Wed Mar 05, 2008 8:14 am Posts: 2864 Location: Rotterdam, The Netherlands
|
 Re: Help with I2C
I have quite a few tutorials on my site  Click on the "tutorials" button to bring up all the articles under that specific heading. - Xander
_________________| Some people, when confronted with a problem, think, "I know, I'll use threads," | and then two they hav erpoblesms. (@nedbat)| My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
| Tue Oct 02, 2012 2:00 pm |
|
 |
|
mattallen37
Expert
Joined: Thu Sep 29, 2011 11:09 pm Posts: 146 Location: Michigan USA
|
 Re: Help with I2C
Yes, in Arduino C/C++, that would indeed send 0x04 to register 0xFE of slave 0x53.
It looks like you are trying to read a Wii extension using an Arduino, in which case I think you mean address 0x52, not 0x53. There are a number of libraries already available for reading e.g. a nunchuk.
Alternately, I would suggest you convert the library that I recently emailed to you.
BTW, the Wire library often used with Arduino C/C++ expects I2C addresses to be 7 bit (bits 0-6) instead of the more common 8 bits (bits 1-7, with bit 0 false).
_________________ Matt
|
| Tue Oct 02, 2012 4:15 pm |
|
 |
|
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 510 Location: Totally not spying on Hassenplug to see what he has for the Brickworld Chicago 2013 sumo contest.
|
 Re: Help with I2C
No, not with an Arduino. I'm trying to read the Wii Motion+, and found some Arduino code for it that I wanted to make sure I was understanding correctly. The copy of the library you sent me does not seem to contain any code for the WM+.
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
| Tue Oct 02, 2012 4:28 pm |
|
 |
|
mattallen37
Expert
Joined: Thu Sep 29, 2011 11:09 pm Posts: 146 Location: Michigan USA
|
 Re: Help with I2C
I attached it to the email I sent you on 10/01/12 at 15:31.
_________________ Matt
|
| Tue Oct 02, 2012 4:32 pm |
|
|
|
Page 1 of 1
|
[ 7 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 2 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|