Hey , hopefully @W11ce or @roads can help me,
so i put this code on my teensy /* Basic USB Joystick Example
Teensy becomes a USB joystick
You must select Joystick from the "Tools > USB Type" menu
Pushbuttons should be connected to digital pins 0 and 1.
Wire each button between the digital pin and ground.
Potentiometers should be connected to analog inputs 0 to 1.
This example code is in the public domain.
*/
void setup() {
pinMode(1, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
}
void loop() {
// read analog inputs and set X-Y position
// read the digital inputs and set the buttons
Joystick.button(1, digitalRead(1));
Joystick.button(2, digitalRead(2));
Joystick.button(3, digitalRead(3));
Joystick.button(4, digitalRead(4));
// a brief delay, so this runs 20 times per second
delay(8);
}
I also tried this one
// Pin 13 has the LED on Teensy 3.1 give it a name
int led = 13;
#define STICK_X 0
#define STICK_Y 1
#define OVERVAL 256
int Xstick;
int Ystick;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
// initialize the digital pins as inputs.
pinMode(1, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
}
// the loop routine runs over and over again forever:
void loop() {
Xstick = map(analogRead(STICK_X), OVERVAL, 1024-OVERVAL, 0, 1024);
Xstick = constrain(Xstick, 0 , 1023);
Joystick.X(Xstick);
Ystick = map(analogRead(STICK_Y), OVERVAL, 1024-OVERVAL, 1024, 0);
Ystick = constrain(Ystick, 0 , 1023);
Joystick.Y(Ystick);
Joystick.button(1, !digitalRead(1));
Joystick.button(2, !digitalRead(2));
Joystick.button(3, !digitalRead(3));
Joystick.button(4, !digitalRead(4));
// turn the LED on (HIGH is the voltage level)
}
so what i'm getting is this, it works on the computer meaning that it shows up that the buttons are being pushed but when i connect it to the xim nothing works.
I try to reboot the teensy once it is connected to the xim but all i get is flashing yellow lights,.
Any suggestions, at the moment i'm just testing the buttons .
I have them connected to the said pins and to the ground.
Any help suggestions would be welcomed
Thanks