Closer

After reviewing Edward Holets' code and connecting a logic analyzer to the [working] Arduino, I decided to pad between bytes when reading from the nunchuck and that helps, though only the Y joystick value seems reliable. Thoughts?

' Use: GET_NUNCHUCK
' -- read nunchuck values into array "joystick"

SUB GET_NUNCHUCK
   I2C_START
   I2C_OUT $A4
   I2C_OUT $00
   I2C_STOP

   DELAY_MS 2

   I2C_START
   I2C_OUT $A5
   DELAY_US 10
   FOR tmpB1 = 0 TO 4
   DELAY_US 10
      joystick(tmpB1) = I2C_IN Ack
   NEXT
   DELAY_US 10
   joystick(5) = I2C_IN Nak
   I2C_STOP
   ENDSUB

Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

Captcha
This question is used to make sure you are a human visitor and to prevent spam submissions.
Copy the characters (respecting upper/lower case) from the image.