1

I'm attempting to use a SparkFun bidirectional level shifter (Link here) to connect up a 3.3v wii nunchuk to a 5v Arduino Uno circuit. For now all I'm trying to do is write the position of the joystick and buttons into the monitor. When I include the shifter in the circuit, the code returns values that are way off what they should be, into the thousands or sometimes minuses. However, when I connect the controller without the shifter (at risk of burning out my controller), the code runs as normal, returning back the x and y axis of the joystick at around 130. Both push buttons have a similar issue, where they read as pressed at random intervals when not even touched. What could be causing the data to be off? I've tried rewiring several times, and am following the SparkFun general use page as a guide, and so hopefully miswiring shouldn't be the issue.

Here is the code:

#include <Wire.h>
#include <ArduinoNunchuk.h>

#define BAUDRATE 19200

ArduinoNunchuk nunchuk = ArduinoNunchuk();

void setup()
{
  Serial.begin(BAUDRATE);
  nunchuk.init();
}

void loop()
{
  nunchuk.update();
  Serial.print(nunchuk.analogX, DEC);
  Serial.print(' ');
  Serial.print(nunchuk.analogY, DEC);
  Serial.print(' ');
  Serial.print(nunchuk.zButton, DEC);
  Serial.print(' ');
  Serial.println(nunchuk.cButton, DEC);
  Serial.print(' ');
  delay(250);
}

Library source :http://www.gabrielbianconi.com/projects/arduinonunchuk/

2
  • 2
    Please show a picture of your wiring. A fresh pair of eyes may spot something you missed.
    – Majenko
    Commented Apr 23, 2022 at 19:06
  • 2
    print the values in hexadecimal ... add a listing of the values to your post ... include a description of what you were expecting to see
    – jsotola
    Commented Apr 23, 2022 at 20:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.