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.
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.
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?