Need some help, SIM SHIFTER

Hi everyone, I'm new to programming/using arduino's in projects, but I am currently in the middle pf building a sim sequential shifter and I'm getting stuck on the programming. I was following loosing a guy who 3D printed one but when it came to the programming his code hasn't worked for me. This is that code.

#include <Joystick.h>

//declare our digital input pins on the board
int upPin = 5;
int downPin = 3;

//this is the value of the input from the switches
int Up = 0;
int Down = 0;

void setup() {
  //setup our pins
  pinMode(upPin, INPUT_PULLUP);
  pinMode(downPin, INPUT_PULLUP);

  //setup the joystick library
  Joystick.begin;
}

I have my Nano board set up with two limit switched wired into D3 and D5 as well as GND/GND
everything mechanically here should work.

Any tips would be greatly appreciated!

Where's loop()?

Hi,
Can you please post a circuit diagram?
How have you got the Up and Down shift switches wired?

Can you please tell us your electronics, programming, arduino, hardware experience?

Thanks.. Tom... :grinning: :+1: :coffee: :australia:

unsure. not a program I wrote. Just trying to use.

Following this diagram however I am using a NANO and ports D3 and D5

Then you didn't obtain the whole program. Go back to wherever you found it, and get the whole program.

Also, you said you have a Nano, but the image shows a Pro Micro. So which one do you have?

I mentioned that I am using a NANO. They had used a different board in their DIY.

This was the entire program he had in his thingyverse package.

//////////////////////////////////////////////////
//  DIY Sim Shifter - For Arduino Leo/ProMicro  //
//                                              //
//  By Brendan Beavis                           //
//  v1.0                                        //
//////////////////////////////////////////////////

#include <Joystick.h>

//declare our digital input pins on the board
int upPin = 8;
int downPin = 5;

//this is the value of the input from the switches
int Up = 0;
int Down = 0;

void setup() {
  //setup our pins
  pinMode(upPin, INPUT_PULLUP);
  pinMode(downPin, INPUT_PULLUP);

  //setup the joystick library
  Joystick.begin();
}

void loop( ){

  //read our values from the switches to the digital input pins
  Up = digitalRead(upPin);
  Down = digitalRead(downPin);

  //write the value of the input to the joystick buttons.
  Joystick.setButton(0,!Up);
  Joystick.setButton(1,!Down);

  //wait a moment before rechecking the status of the inputs
  delay(50);
}


I don't care to use their program or not, but ideally I'm looking to get my Nano and limit switches to act like a joystick/controller to press an up and down button for sim gearing.

I know nothing about programming of these things and have only used one before to run a servo from a rc ESC but nothing like a plugged in USB controller.

Well, a Nano has no HID capability. So you're out of luck, trying to use it for a joystick controller.

Meaning?

I am trying to make a joystick? just two button

Am I just better off ordering the right board? he used Arduino Pro Micro (ATMEGA32U4)

Yes.

will do. Just had the NANO's around and was hoping to use them

Hi,'
Sorry that Fritzy tells me very little.
Please draw a circuit diagram, pen(cil) and paper.
Include joysticks and component names and pin labels.

How are the limit switches wired, COM-NC or COM-NO.

What type of joystick are you using?
The proportional type with potentiometers for the 2 axes?
OR
The arcade type with 4 switches to give basic 4 direction?

Thanks.. Tom.. :grinning: :+1: :coffee: :australia:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.