BS2 and Nunchuck
drake
Posts: 7
So about a month and a half ago I received a wiichuck breakout board for the nunchuck.
I began working on some code on my BS2 to pull data from the nunchuck but so far I have been unsuccessful.
First some known facts:
The nunchuck communicates via I2C
The nunchucks address is 0x52
to start communications you must send 0x40 0x00 to the nunchuck
data is returned in a 6 byte array
after you read data you must send 0x00 to start reading more data
BS2 does not have i2c built in but can be bit bashed via shiftin and shift out (nuts and volts #85)
What I have tried so far:
use the code from the nuts and volts to send data directly
use other versions of other peoples code modified for my needs
use a version of code that does EVERYTHING by hand (no shiftin or shift out)
Each attempt has yielded the same results
When the first packet is sent 0xa4 0x40 0x00 i get an ack from ONLY the 0xa4. the 0x40 and 0x00 nack
all the data retrieved ends up being 0xFF
Any ideas on what I can be doing wrong?
Has anyone actually interfaced a BS2 with a nunchuck?
I began working on some code on my BS2 to pull data from the nunchuck but so far I have been unsuccessful.
First some known facts:
The nunchuck communicates via I2C
The nunchucks address is 0x52
to start communications you must send 0x40 0x00 to the nunchuck
data is returned in a 6 byte array
after you read data you must send 0x00 to start reading more data
BS2 does not have i2c built in but can be bit bashed via shiftin and shift out (nuts and volts #85)
What I have tried so far:
use the code from the nuts and volts to send data directly
use other versions of other peoples code modified for my needs
use a version of code that does EVERYTHING by hand (no shiftin or shift out)
Each attempt has yielded the same results
When the first packet is sent 0xa4 0x40 0x00 i get an ack from ONLY the 0xa4. the 0x40 and 0x00 nack
all the data retrieved ends up being 0xFF
Any ideas on what I can be doing wrong?
Has anyone actually interfaced a BS2 with a nunchuck?
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
Figured Id give it a whirl with the bs2 seeing that I already had it.
The end result of this project will be a larger robot with a netbook as the brains. I wanted a uC as the processor of the sensor information seeing that the netbooks don't have serial or parallel ports.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think Inside the box first and if that doesn't work..
Re-arrange what's inside the box then...
Think outside the BOX!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
But whatever, give it a try.
As far as the linux support. The arduino environment is setup in java and because java is cross platform including linux its supported with the proper drivers. Also being in java its easier to access and modify what I want back from it.
A good portion of my robot will be Java. In fact a layer of communications is already written in java. I will not be using the stamp or arduino for the main motor controllers instead I have 2 (and room for more) TI Jaguars which are in themselves microcontrollers. They have the ability to control voltage, current, speed or position in closed or open loop control modes. They also have built in limit switch and encoder readings.
I can and probably will still use the stamp for a different part of the project. Maybe I will use the stamp to run a program to move a pair of cameras to generate a psudo 3D map.