Teensy 2.0 Timeout with error code 6 to Wii Nunchuck

maxuuell

New member
Hello all.

I have a teensy 2.0 wired up with 3, 4.7k ohm resistors, trying to talk to a wii nunchuck via I2C. See photos for my monstrosity 😅.

I am using Teensy Loader 1.52, and Teensyduino 1.57 with Arduino 1.8.19.

I am getting the "6" error code after `Wire.endTransmission`. Some reading shows it's a timeout error, but I only get that when I use `WSWire` library, which prevents the `Wire.endTransmission` from hanging, which it does if I don't use `WSWire` library. The default `Wire` library just hangs.

Can anyone help me identify why this is happening?

My hunch is that my wiring is wrong/weak/otherwise messed up, because I just can't communicate with the nunchuck. I've used the same chuck with an Arduino Nano Every, and didn't have a problem getting controller input to the serial monitor.

The code provided is for scanning addresses, which I found somewhere, but should do the same as the scanning sketch/scanning code on the teensy website.

This is my first project like this, so any general guidance would also be appreciated. Thank you.

Photos:
IMG_4865.jpgIMG_4866.jpg

Code:
#include <WSWire.h>

void setup() {
  Serial.begin (115200);

  // Leonardo: wait for serial port to connect
  while (!Serial) 
    {
    }

  Serial.println ();
  Serial.println ("I2C scanner. Scanning ...");
  byte count = 0;
  
  Wire.begin();
  uint8_t error = 0;
  for (byte i = 8; i < 120; i++)
  {
    Wire.beginTransmission (i);
    error = Wire.endTransmission();
    if (error == 0)
      {
      Serial.print ("Found address: ");
      Serial.print (i, DEC);
      Serial.print (" (0x");
      Serial.print (i, HEX);
      Serial.println (")");
      count++;
      delay (1);  // maybe unneeded?
      } else {
        Serial.println(error); 
      }
  } // end of for loop
  Serial.println ("Done.");
  Serial.print ("Found ");
  Serial.print (count, DEC);
  Serial.println (" device(s).");
}  // end of setup

void loop() {}

Serial Monitor Response:
Code:
I2C scanner. Scanning ...

I2C scanner. Scanning ...

I2C scanner. Scanning ...
6
6
... removed lots of 6s for brevity...
Done.
Found 0 device(s).
 
Back
Top