I ordered a Sparkfun Pro Micro 3.3v (DEV-12587) and got it on 2/11. I’ve been using with the plans to make a gamepad. I got the buttons working flawlessly but when I got to the Joystick, it wouldn’t work. It usually just floats but sometimes it just shows a HIGH input. Yes, I know the board is only 3.3v. I’ve been using a breadboard power module for 5v.
I tested the Analog Pins with multiple Joysticks, Potentiometers, Example Sketches, etc. Nothing. I took the Arduino Joystick Test Example that didn’t work on the Micro and uploaded it to my 2560 Mega with the same Joystick wired the same way. It worked perfectly. Is there something I’m missing or is this board defective?
Micro Joystick Wiring:
https://i.imgur.com/NKa6yfc.jpgMega Wiring:
https://i.imgur.com/hjSNY5C.jpgMicro Serial:
https://i.imgur.com/AV7pPP5.pngMega Serial:
https://i.imgur.com/MOuSqi8.pngHere is the code I tried on the Mega:
#include <Joystick.h>
#include <AxisJoystick.h>
#define SW_PIN 5
#define VRX_PIN A0
#define VRY_PIN A1
Joystick* joystic;
// the setup function runs once when you press reset or power the board
void setup() {
Serial.begin(9600);
joystic = new AxisJoystick(SW_PIN, VRX_PIN, VRY_PIN);
}
// the loop function runs over and over again forever
void loop() {
Serial.print("| SingleRead: " + moveTitle(joystic->singleRead()));
Serial.print(" | MultipleRead: " + moveTitle(joystic->multipleRead()));
Serial.print(" | Press: " + String(joystic->isPress()));
Serial.print(" | Up: " + String(joystic->isUp()));
Serial.print(" | Down: " + String(joystic->isDown()));
Serial.print(" | Right: " + String(joystic->isRight()));
Serial.print(" | Left: " + String(joystic->isLeft()));
Serial.print(" | VRx: " + String(joystic->readVRx()));
Serial.print(" | VRy: " + String(joystic->readVRy()));
Serial.println(" | SW: " + String(joystic->readSW()) + " |");
delay(500); // optionally, only to delay the output of information in the example
}
/**
Return title of the input joystick move.
*/
String moveTitle(const Joystick::Move move) {
switch (move) {
case Joystick::Move::NOT:
return "NOT";
case Joystick::Move::PRESS:
return "PRESS";
case Joystick::Move::UP:
return "UP";
case Joystick::Move::DOWN:
return "DOWN";
case Joystick::Move::RIGHT:
return "RIGHT";
case Joystick::Move::LEFT:
return "LEFT";
default:
return "???";
}
}