Forum Rule: Always post complete source code & details to reproduce any issue!
Page 5 of 7 FirstFirst ... 3 4 5 6 7 LastLast
Results 101 to 125 of 162

Thread: Many axis joystick

  1. #101
    Junior Member
    Join Date
    Jul 2014
    Posts
    2
    Quote Originally Posted by giliep View Post
    @brydling

    Was that for me?
    Its a bit over my head. I'm not a programmer so i don't understand it. I want to know what i need to change in order to make it compatible for the teensy 2.0++
    No, that was for Paul. I read that he needed a way to test all the inputs on the controller.

  2. #102
    Junior Member
    Join Date
    Dec 2014
    Posts
    2
    Hello Paul,

    your joystick project is really good. I am very new to this electronic stuff and i really need help. Now, i want to make this huge joystick and use it as flight simulator controller. However i dont know how to connect this many buttons to the pins on teensy. Because there is no enough pins for all buttons. Do you have any scheme how to connect this 128 buttons 17 sliders and others ? I saw you published some breakboard but its not fully functional, i want to use all of buttons and sliders. Could you make a scheme or something like that maybe pcb scheme ( i am not sure what it is ). So i can take it and make cool joystick. Thank you very much Happy new years

  3. #103
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,576
    There are many ways to connect lots of buttons. Three are widely used:

    1: A row-column matrix
    http://www.pjrc.com/teensy/td_libs_Keypad.html

    2: Using shift registers, like 74HC165

    3: Using I2C I/O expanders, read with the Wire library
    https://www.adafruit.com/product/593

  4. #104
    Junior Member
    Join Date
    Mar 2014
    Posts
    11
    Paul, I've got some boards designed that allow me to easily create diode-isolated input matrices for the exact kind of project that U.K. is working on. Can the keypad library deal with having some (or all!) of the switches in a matrix closed? Can it handle a large (say 8x32) matrix?

    Thanks for your time!

    g.

  5. #105
    Junior Member
    Join Date
    Dec 2014
    Posts
    2
    Quote Originally Posted by PaulStoffregen View Post
    There are many ways to connect lots of buttons. Three are widely used:

    1: A row-column matrix
    http://www.pjrc.com/teensy/td_libs_Keypad.html

    2: Using shift registers, like 74HC165

    3: Using I2C I/O expanders, read with the Wire library
    https://www.adafruit.com/product/593
    Thank you very much for your answering.

  6. #106
    Junior Member
    Join Date
    Feb 2015
    Location
    Brazil
    Posts
    1
    Hello Paul.

    Been very much interested in this project, i`m new here and building a home cockpit, so i would need that many buttons (128+) as (ON/OFF). (ON/OFF/ON) and soo on.

    I would like to know if you could do a list of how to or such for those of us with simple knowledge, kind of PDF walkthrough. And i`m reading through to buy the stuff and really test this out.

    I know the wiring, switches and the interface with the Sim. software, but the kind of materials not soo much, but keen to learn.

    Thanks for your time

  7. #107
    Junior Member
    Join Date
    Feb 2015
    Posts
    10
    Yes, having it broken down barny style would really be nice.

    For example, how does one physically wire a bunch of switches into a matrix? Can we follow diagrams written for the Epic card?

    The keypad link seems to talk about coding, not wiring
    Last edited by DangerMouse; 03-17-2015 at 08:50 PM.

  8. #108
    Junior Member
    Join Date
    Apr 2014
    Posts
    15

    fixed?

    I recently ran into a compilation error using the extreme joystick library from post #36 in this thread.

    I detailed the error in a post here, but basically one of the structs in usb_desc.h was being included twice and throwing a compiler error.

    I fixed by wrapping the following code, located near the bottom of usb_desc.h from the extreme joystick lib with a #ifndef...

    Code:
    #ifndef _usb_dec_t
    #define _usb_dec_t
    extern const uint8_t usb_endpoint_config_table[NUM_ENDPOINTS];
    
    typedef struct {
    	uint16_t	wValue;
    	uint16_t	wIndex;
    	const uint8_t	*addr;
    	uint16_t	length;
    } usb_descriptor_list_t;
    
    extern const usb_descriptor_list_t usb_descriptor_list[];
    #endif
    Can anyone else see if they get the same error and confirm that the fix works for them. It's working for me.

    It may be a bandaid, not a proper fix, but I'm not familiar enough with C to know what the best approach would be. Also, usb_desc.h has its own #ifndef at the top, I would have thought that would have covered the above struct.
    Last edited by zelfor; 06-06-2015 at 09:33 PM. Reason: added info

  9. #109
    Junior Member
    Join Date
    Mar 2014
    Posts
    13

    How to change joystick

    Can anyone help out noob here, please? I have changed my HID header to be 64 buttons and 28 sliders (no axes, no hats) - this will be used in Linux only as we know windows has their own idea about the HID spec.

    My problem comes in not knowing exactly what changes to make in usb_joystick.h Below is the code I have now and I can see the buttons being pressed in DiView but not the sliders move. The serial monitor shows the data changing as expected. The original extreme joystick worked fine.

    Code:
    int usb_joystick_send(void);
    extern uint32_t usb_joystick_data[16];
    
    
    class usb_joystick_class
    {
        public:
            void begin(void) { }
            void end(void) { }
    	void button(unsigned int num, bool val) {
    		if (--num >= 64) return;
    		uint32_t *p = usb_joystick_data + (num >> 5);
    		num &= 0x1F;
    		if (val) *p |= (1 << num);
    		else *p &= ~(1 << num);
    		if (!manual_mode) usb_joystick_send();
    	}
    	void slider(unsigned int num, unsigned int position) {
    		if (--num >= 28) return;
    		analog16(num, position);
    	}
    	void useManualSend(bool mode) {
    		manual_mode = mode;
    	}
    	void send_now(void) {
    		usb_joystick_send();
    	}
    	private:
    	void analog16(unsigned int num, unsigned int value) {
    		if (value > 0xFFFF) value = 0xFFFF;
    		uint16_t *p = (uint16_t *)(&usb_joystick_data[4]);
    		p[num] = value;
            if (!manual_mode) usb_joystick_send();
    	}
    	static uint8_t manual_mode;
    };
    extern usb_joystick_class Joystick;
    and the new hid descriptor (in usb_desc.c):

    Code:
        0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)
        0x09, 0x04,                    // USAGE (Joystick)
        0xa1, 0x01,                    // COLLECTION (Application)
        0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
        0x25, 0x01,                    //   LOGICAL_MAXIMUM (1)
        0x75, 0x01,                    //   REPORT_SIZE (1)
        0x95, 0x40,                    //   REPORT_COUNT (64)
        0x05, 0x09,                    //   USAGE_PAGE (Button)
        0x19, 0x01,                    //   USAGE_MINIMUM (Button 1)
        0x29, 0x40,                    //   USAGE_MAXIMUM (Button 64)
        0x81, 0x02,                    //   INPUT (Data,Var,Abs)
        0x05, 0x01,                    //   USAGE_PAGE (Generic Desktop)
        0x09, 0x01,                    //   USAGE (Pointer)
        0xa1, 0x00,                    //   COLLECTION (Physical)
        0x15, 0x00,                    //     LOGICAL_MINIMUM (0)
        0x27, 0xff, 0xff, 0x00, 0x00,  //     LOGICAL_MAXIMUM (65535)
        0x75, 0x10,                    //     REPORT_SIZE (16)
        0x95, 0x1C,                    //     REPORT_COUNT (28)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x09, 0x36,                    //     USAGE (Slider)
        0x81, 0x02,                    //     INPUT (Data,Var,Abs)
        0xc0,                          //   END_COLLECTION
        0xc0                           // END_COLLECTION

  10. #110
    Junior Member
    Join Date
    Aug 2015
    Location
    WA State
    Posts
    3
    Hi guys, new here. I have a working Teensy 3.1 in flight sim switch panel already. I'm not interested in using more than the 34 digital inputs, however I've like to be able to send a different button press when a toggle switch is turned off vs when it's turned on, this gives my the greatest versatility with different aircraft and how the developers have chosen to create button assignments for them (some use the same button to toggle a switch, others offer a button for each position of the switch). I understand how to do this in my sketch, however I need my "joystick" to have more than 32 button assignments available.

    That's where this thread comes in. I have downloaded the USB code and the example .ino file in post #36. If I use the included "extremejoysticktest.ino" file, the joystick shows up (in Pointy's joystick tester) with all 128 buttons. As soon as I upload the my sketch to the Teensy, only 32 buttons show up. I was under the impression that the USB code is what determined how many buttons and axis' the "joystick" has, I don't understand why using other sketches breaks it.

    This code is an adaptation of the "buttons" example.

    Code:
    /* Buttons to USB Joystick Example
    
       You must select Joystick from the "Tools > USB Type" menu
    
       This example code is in the public domain.
    */
    
    #include <Bounce.h>
    #include <usb_names.h>
    
    // Create Bounce objects for each button.  The Bounce object
    // automatically deals with contact chatter or "bounce", and
    // it makes detecting changes very simple.
    Bounce button0 = Bounce(0, 10);
    Bounce button1 = Bounce(1, 10);  // 10 = 10 ms debounce time
    Bounce button2 = Bounce(2, 10);  // which is appropriate for
    Bounce button3 = Bounce(3, 10);  // most mechanical pushbuttons
    Bounce button4 = Bounce(4, 10);
    Bounce button5 = Bounce(5, 10);
    Bounce button6 = Bounce(6, 10);
    Bounce button7 = Bounce(7, 10);
    Bounce button8 = Bounce(8, 10);
    Bounce button9 = Bounce(9, 10);
    Bounce button10 = Bounce(10, 10);
    Bounce button11 = Bounce(11, 10);  // 10 = 10 ms debounce time
    Bounce button12 = Bounce(12, 10);  // which is appropriate for
    Bounce button13 = Bounce(13, 10);  // most mechanical pushbuttons
    Bounce button14 = Bounce(14, 10);
    Bounce button15 = Bounce(15, 10);
    Bounce button16 = Bounce(16, 10);
    Bounce button17 = Bounce(17, 10);
    Bounce button18 = Bounce(18, 10);
    Bounce button19 = Bounce(19, 10);
    Bounce button20 = Bounce(20, 10);  // 10 = 10 ms debounce time
    Bounce button21 = Bounce(21, 10);  // which is appropriate for
    Bounce button22 = Bounce(22, 10);  // most mechanical pushbuttons
    Bounce button23 = Bounce(23, 10);
    Bounce button24 = Bounce(24, 10);
    Bounce button25 = Bounce(25, 10);
    Bounce button26 = Bounce(26, 10);
    Bounce button27 = Bounce(27, 10);
    Bounce button28 = Bounce(28, 10);
    Bounce button29 = Bounce(29, 10);
    Bounce button30 = Bounce(30, 10);
    Bounce button31 = Bounce(31, 10);
    Bounce button32 = Bounce(32, 10);
    Bounce button33 = Bounce(33, 10);
    
    
    
    void setup() {
      // Configure the pins for input mode with pullup resistors.
      // The pushbuttons connect from each pin to ground.  When
      // the button is pressed, the pin reads LOW because the button
      // shorts it to ground.  When released, the pin reads HIGH
      // because the pullup resistor connects to +5 volts inside
      // the chip.  LOW for "on", and HIGH for "off" may seem
      // backwards, but using the on-chip pullup resistors is very
      // convenient.  The scheme is called "active low", and it's
      // very commonly used in electronics... so much that the chip
      // has built-in pullup resistors!
      pinMode(0, INPUT_PULLUP);
      pinMode(1, INPUT_PULLUP);
      pinMode(2, INPUT_PULLUP);
      pinMode(3, INPUT_PULLUP);
      pinMode(4, INPUT_PULLUP);
      pinMode(5, INPUT_PULLUP);
      pinMode(6, INPUT_PULLUP);  // Teensy++ LED, may need 1k resistor pullup
      pinMode(7, INPUT_PULLUP);
      pinMode(8, INPUT_PULLUP);
      pinMode(9, INPUT_PULLUP);
      pinMode(10, INPUT_PULLUP);
      pinMode(11, INPUT_PULLUP);
      pinMode(12, INPUT_PULLUP);
      pinMode(13, INPUT_PULLUP);
      pinMode(14, INPUT_PULLUP);
      pinMode(15, INPUT_PULLUP);
      pinMode(16, INPUT_PULLUP);  // Teensy++ LED, may need 1k resistor pullup
      pinMode(17, INPUT_PULLUP);
      pinMode(18, INPUT_PULLUP);
      pinMode(19, INPUT_PULLUP);
      pinMode(20, INPUT_PULLUP);
      pinMode(21, INPUT_PULLUP);
      pinMode(22, INPUT_PULLUP);
      pinMode(23, INPUT_PULLUP);
      pinMode(24, INPUT_PULLUP);
      pinMode(25, INPUT_PULLUP);
      pinMode(26, INPUT_PULLUP);  // Teensy++ LED, may need 1k resistor pullup
      pinMode(27, INPUT_PULLUP);
      pinMode(28, INPUT_PULLUP);
      pinMode(29, INPUT_PULLUP);
      pinMode(30, INPUT_PULLUP);
      pinMode(31, INPUT_PULLUP);
      pinMode(32, INPUT_PULLUP);
      pinMode(33, INPUT_PULLUP);
    }
    
    void loop() {
      // Update all the buttons.  There should not be any long
      // delays in loop(), so this runs repetitively at a rate
      // faster than the buttons could be pressed and released.
      button0.update();
      button1.update();
      button2.update();
      button3.update();
      button4.update();
      button5.update();
      button6.update();
      button7.update();
      button8.update();
      button9.update();
      button10.update();
      button11.update();
      button12.update();
      button13.update();
      button14.update();
      button15.update();
      button16.update();
      button17.update();
      button18.update();
      button19.update();
      button20.update();
      button21.update();
      button22.update();
      button23.update();
      button24.update();
      button25.update();
      button26.update();
      button27.update();
      button28.update();
      button29.update();
      button30.update();
      button31.update();
      button32.update();
      button33.update();
    
      // Check each button for "falling" edge.
      // Update the Joystick buttons only upon changes.
      // falling = high (not pressed - voltage from pullup resistor)
      //           to low (pressed - button connects pin to ground)
      if (button5.fallingEdge()) {
        Joystick.button(6, 1);
      }
      if (button6.fallingEdge()) {
        Joystick.button(7, 1);
      }
      if (button7.fallingEdge()) {
        Joystick.button(8, 1);
         delay(200);
        Joystick.button(8, 0);
      }
      if (button8.fallingEdge()) {
        Joystick.button(9, 1);
         delay(200);
        Joystick.button(9, 0);
      }
      if (button9.fallingEdge()) {
        Joystick.button(10, 1);
         delay(200);
        Joystick.button(10, 0);
      }
      if (button10.fallingEdge()) {
        Joystick.button(11, 1);
         delay(200);
        Joystick.button(11, 0);
      }
      if (button11.fallingEdge()) {
        Joystick.button(12, 1);
         delay(200);
        Joystick.button(12, 0);
      }
      if (button12.fallingEdge()) {
        Joystick.button(13, 1);
         delay(200);
        Joystick.button(13, 0);
      }
      if (button13.fallingEdge()) {
        Joystick.button(33, 1);
         delay(200);
        Joystick.button(33, 0);
      }
      if (button14.fallingEdge()) {
        Joystick.button(15, 1);
         delay(200);
        Joystick.button(15, 0);
      }
      if (button15.fallingEdge()) {
        Joystick.button(16, 1);
         delay(200);
        Joystick.button(16, 0);
      }
      if (button16.fallingEdge()) {
        Joystick.button(17, 1);
         delay(200);
        Joystick.button(17, 0);
      }
      if (button17.fallingEdge()) {
        Joystick.button(18, 1);
         delay(200);
        Joystick.button(18, 0);
      }
      if (button18.fallingEdge()) {
        Joystick.button(19, 1);
         delay(200);
        Joystick.button(19, 0);
      }
      if (button19.fallingEdge()) {
        Joystick.button(20, 1);
         delay(200);
        Joystick.button(20, 0);
      }
      if (button20.fallingEdge()) {
        Joystick.button(21, 1);
         delay(200);
        Joystick.button(21, 0);
      }
      if (button21.fallingEdge()) {
        Joystick.button(22, 1);
         delay(200);
        Joystick.button(22, 0);
      }
      if (button22.fallingEdge()) {
        Joystick.button(23, 1);
         delay(200);
        Joystick.button(23, 0);
      }
      if (button23.fallingEdge()) {
        Joystick.button(24, 1);
         delay(200);
        Joystick.button(24, 0);
      }
      if (button24.fallingEdge()) {
        Joystick.button(25, 1);
      }
      if (button25.fallingEdge()) {
        Joystick.button(26, 1);
         delay(200);
        Joystick.button(26, 0);
      }
      if (button26.fallingEdge()) {
        Joystick.button(27, 1);
         delay(200);
        Joystick.button(27, 0);
      }
      if (button27.fallingEdge()) {
        Joystick.button(28, 1);
         delay(200);
        Joystick.button(28, 0);
      }
      if (button28.fallingEdge()) {
        Joystick.button(29, 1);
         delay(200);
        Joystick.button(29, 0);
      }
      if (button29.fallingEdge()) {
        Joystick.button(30, 1);
         delay(200);
        Joystick.button(30, 0);
      }
      if (button30.fallingEdge()) {
        Joystick.button(31, 1);
         delay(200);
        Joystick.button(31, 0);
      }
      if (button31.fallingEdge()) {
        Joystick.button(32, 1);
         delay(200);
        Joystick.button(32, 0);
      }
      if (button32.fallingEdge()) {
        Joystick.button(5, 1);
         delay(200);
        Joystick.button(5, 0);
      }
      if (button33.fallingEdge()) {
        Joystick.button(4, 1);
      }
    
    
      // Check each button for "rising" edge
      // Update the Joystick buttons only upon changes.
      // rising = low (pressed - button connects pin to ground)
      //          to high (not pressed - voltage from pullup resistor)
      if (button5.risingEdge()) {
        Joystick.button(6, 0);
      }
      if (button6.risingEdge()) {
        Joystick.button(7, 0);
      }
      if (button7.risingEdge()) {
        Joystick.button(3, 1);
         delay(200);
        Joystick.button(3, 0);
      }
      if (button8.risingEdge()) {
        Joystick.button(9, 1);
         delay(200);
        Joystick.button(9, 0);
      }
      if (button9.risingEdge()) {
        Joystick.button(10, 1);
         delay(200);
        Joystick.button(10, 0);
      }
      if (button10.risingEdge()) {
        Joystick.button(11, 1);
         delay(200);
        Joystick.button(11, 0);
      }
      if (button11.risingEdge()) {
        Joystick.button(12, 1);
         delay(200);
        Joystick.button(12, 0);
      }
      if (button12.risingEdge()) {
        Joystick.button(13, 1);
         delay(200);
        Joystick.button(13, 0);
      }
      if (button13.risingEdge()) {
        Joystick.button(14, 0);
      }
      if (button14.risingEdge()) {
        Joystick.button(15, 1);
         delay(200);
        Joystick.button(15, 0);
      }
      if (button15.risingEdge()) {
        Joystick.button(16, 1);
         delay(200);
        Joystick.button(16, 0);
      }
      if (button16.risingEdge()) {
        Joystick.button(17, 1);
         delay(200);
        Joystick.button(17, 0);
      }
      if (button17.risingEdge()) {
        Joystick.button(18, 1);
         delay(200);
        Joystick.button(18, 0);
      }
      if (button18.risingEdge()) {
        Joystick.button(3, 1);
         delay(200);
        Joystick.button(3, 0);
      }
      if (button19.risingEdge()) {
        Joystick.button(20, 0);
      }
      if (button20.risingEdge()) {
        Joystick.button(21, 0);
      }
      if (button21.risingEdge()) {
        Joystick.button(22, 0);
      }
      if (button22.risingEdge()) {
        Joystick.button(23, 0);
      }
      if (button23.risingEdge()) {
        Joystick.button(24, 0);
      }
      if (button24.risingEdge()) {
        Joystick.button(25, 0);
      }
      if (button25.risingEdge()) {
        Joystick.button(26, 0);
      }
      if (button26.risingEdge()) {
        Joystick.button(27, 1);
         delay(200);
        Joystick.button(27, 0);
      }
      if (button27.risingEdge()) {
        Joystick.button(28, 1);
         delay(200);
        Joystick.button(28, 0);
      }
      if (button28.risingEdge()) {
        Joystick.button(29, 0);
      }
      if (button29.risingEdge()) {
        Joystick.button(30, 0);
      }
      if (button30.risingEdge()) {
        Joystick.button(31, 0);
      }
      if (button31.risingEdge()) {
        Joystick.button(32, 0);
      }
      if (button32.risingEdge()) {
        Joystick.button(5, 0);
      }
      if (button33.risingEdge()) {
        Joystick.button(4, 0);
      }
    }
    Last edited by Deezle; 08-30-2015 at 03:10 AM.

  11. #111
    Junior Member
    Join Date
    Aug 2015
    Location
    WA State
    Posts
    3
    Well, I've found that incrementing bcdDevice in usb_desc.c every time I upload a sketch will make the joystick show up with 128 buttons, however I'm unable to get any buttons to respond using the sketch I posted above. Works fine with the default USB code.

  12. #112
    Junior Member
    Join Date
    Dec 2015
    Posts
    1
    Will this code work on a teensy 3.2? I'm trying to get a PS/2 keyboard to output as a game controller.

    EDIT:
    It turns out I've actually got a teensy 3.1 built into another controller and a spare 2.0 lying around that was originally intended for that project. Still, an answer to the question might be useful to others.
    Last edited by 98abaile; 01-01-2016 at 01:45 PM.

  13. #113
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,576
    It should work on Teensy 3.2. It was written and tested on Teensy 3.1, which is identical to Teensy 3.2 as far as this code is concerned.

    Quite a lot has changed and improved in Teensyduino since it was written almost 2 years ago. If there are any issues, 3.1 and 3.2 will likely be impacted the same way.

  14. #114
    Junior Member
    Join Date
    Jan 2016
    Posts
    10
    i'm working to create a trim box with 6 rotaries and maybe 6 on-on switches. would i be ok using an existing HID or should i try to pare down until i only have the axis and buttons i require?

  15. #115
    Junior Member
    Join Date
    Sep 2015
    Posts
    3
    Hi everyone.

    I'm trying to set up a joystick with 128 buttons (no need for sliders etc). But it seems like the patch from Paul isn't working on the latest Teensy build. Can anyone confirm?

    I just downloaded the files from the last patch Paul provided and moved them to the teensy folder (replacing the 4 files).

    I get the following error message during compiling:

    Code:
    /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/usb_joystick.c: In function 'usb_joystick_send':
    /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/usb_joystick.c:78:36: error: 'TX_TIMEOUT' undeclared (first use in this function)
    if (++wait_count > TX_TIMEOUT || transmit_previous_timeout) {
    ^
    /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/usb_joystick.c:78:36: note: each undeclared identifier is reported only once for each function it appears in
    exit status 1
    Could anyone give me a hand here? I don't know where to start ...

  16. #116
    I'm trying to make a much more basic arcade stick than the things people are making here, just 10 buttons and a 4 way digital joystick. I'm trying to adapt the Teensy stock example for joystick_complete to work for what I'm doing, but I ran into a few serious problems:

    1. Even though my computer recognizes my device (computer+mouse+joystick teensy 2.0), if I go into controller properties, the window that would normally show you the POV hat as well as all the button functions, is completely empty, it's not even like it shows the red button symbols but I can't get them to work, straight up the window that is supposed to show that is empty.

    2. I can't figure out how to get the POV hat working to begin with. I think the example is set up so that you can put one in directly, but I have no idea how to actually go about doing so.

    Here is my code, any help is greatly appreciated, I've been trying to get this thing working for a really long time.

    Code:
    const int numButtons = 14;
    // Changes numButtons to be the specific pins that are wired rather than being incremental 0-16
    const uint8_t buttons[numButtons] = { 0, 1, 2, 3, 16, 17, 18, 19, 20, 21 /* ... */ };
    
    void setup() {
      // you can print to the serial monitor while the joystick is active!
      Serial.begin(9600);
      // configure the joystick to manual send mode.  This gives precise
      // control over when the computer receives updates, but it does
      // require you to manually call Joystick.send_now().
      Joystick.useManualSend(true);
      for (int i=0; i<numButtons; i++) {
        pinMode(buttons[i], INPUT_PULLUP);
      }
      Serial.println("Begin Complete Joystick Test");
    }
    
    byte allButtons[numButtons];
    byte prevButtons[numButtons];
    int angle=0;
    
    void loop() {
    
      
      // read digital pins and use them for the buttons
      for (int i=0; i<numButtons; i++) {
        if (digitalRead(buttons[i])) {
          // when a pin reads high, the button is not pressed
          // the pullup resistor creates the "on" signal
          allButtons[i] = 0;
        } else {
          // when a pin reads low, the button is connecting to ground.
          allButtons[i] = 1;
        }
        Joystick.button(i + 1, allButtons[i]);
        
      }
    
      // make the hat switch automatically move in a circle
      angle = angle + 1;
      if (angle >= 360) angle = 0;
      Joystick.hat(angle);
      
      // Because setup configured the Joystick manual send,
      // the computer does not see any of the changes yet.
      // This send_now() transmits everything all at once.
      Joystick.send_now();
      
      // check to see if any button changed since last time
      boolean anyChange = false;
      for (int i=0; i<numButtons; i++) {
        if (allButtons[i] != prevButtons[i]) anyChange = true;
        prevButtons[i] = allButtons[i];
      }
      
      // if any button changed, print them to the serial monitor
      if (anyChange) {
        Serial.print("Buttons: ");
        for (int i=0; i<numButtons; i++) {
          Serial.print(allButtons[i], DEC);
        }
        Serial.println();
      }
      
      // a brief delay, so this runs 200 times per second
      delay(5);
    }

  17. #117
    Member
    Join Date
    Mar 2014
    Location
    Valencia
    Posts
    58
    Quote Originally Posted by PaulStoffregen View Post
    It should work on Teensy 3.2. It was written and tested on Teensy 3.1, which is identical to Teensy 3.2 as far as this code is concerned.

    Quite a lot has changed and improved in Teensyduino since it was written almost 2 years ago. If there are any issues, 3.1 and 3.2 will likely be impacted the same way.
    Hello again Paul

    Do you think that code of "joystick" (this link) in teensy 3.1 is compatible with teensy LC? I want to buy one.

    https://forum.pjrc.com/threads/23681...ll=1#post41730
    Last edited by carcaes1; 03-03-2016 at 10:18 AM.

  18. #118
    Junior Member
    Join Date
    Nov 2016
    Posts
    3
    just registrating to forum and im newbie, and want ask, what i need make ONLY 16 axes analog input (i hear arduino mega board can do) i not need buttons/switch or encoders. only analog input my flight sim X yuoke,rudder,trottle, trimm etc.
    i have at home some arduino mega 2560 board whit ch340 chip, can i use this or need me orden teensy or other board ?
    how make description and compile to hex file ?
    how burn hex file to possiple board ?
    or can somebody make me hex file what use ONLY maximum axes and slider what can add to board ?
    i no understand anythink how this made but i need my fsx analog input i made own yuoke rudder trottle, trim wheel, etc.

    can anyone help me how made or make to me hex file mega 2560 board or teensy and what version teensy i need orden ? how many analog teensy can add ?
    mail me if can made to me hex file and /or descition to mega or teensy board. (we talk how much cost)

    just has make ready arduino mega 2560 board whit 4x max 7219 chip led matrix board to use 5 digit 7-segment display (5digit x 4 radiopanel = 20 number) com nav 1 activ+standby and 2xchange button and 2xencoder have. easy made whit mobiflight software working fine.
    but need analog axes too and mobiflight not support analog input.

    my computer have WIN8, FSX gold edition, own radio panel, mobiflight software, fsuipc4,wideview,fs-panel,landing gears,many led and switch,annuincator,
    future need made ADF,autopilot,yuoke,rudder,trottle,trim wheels,brake,etc.
    Last edited by masawee; 11-16-2016 at 08:46 PM.

  19. #119
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    Quote Originally Posted by masawee View Post
    i have at home some arduino mega 2560 board whit ch340 chip, can i use this or need me orden teensy or other board ?
    The arduino mega can't do that. You need a Teensy.


    Quote Originally Posted by masawee View Post
    how make description and compile to hex file ?
    oh... it's not plug and play..you need some programming skills, of course.
    Download Arduino, Teensyduino, and write the needed Software


    Quote Originally Posted by masawee View Post
    how burn hex file to possiple board ?
    Press "upload" in Arduino.
    or can somebody make me hex file what use ONLY maximum axes and slider what can add to board ?
    What do you pay ? :-)

    No, with a bit luck, maybe, someone from this forum is willing to help..

  20. #120
    Junior Member
    Join Date
    Nov 2016
    Posts
    3
    What teensy version have best to me ? axis and slider analog input maxim ?
    i looking teensy 3.2 have maximum input analog pin what can use,
    can all use whit usb-hid to fsx ?

    teensy have wery expensive VS, arduino mega have only under 10€ were have cheapen place orden teensy and what version(looking first guestion)

    hmm, you mean arduino IDE ? what is teensyduino ? ok, teensyduino have addon -on arduino IDE, must loadin then have orden teensy 3.2.


    Press "upload" in Arduino. mean arduino IDE ? burn bootloader or upload ino file. 2 different,


    What do you pay ? :-) what u want

    shit here not can orden teensy whit paypal no thanks, must looking ebay what have

    No, with a bit luck, maybe, someone from this forum is willing to help..[/QUOTE]

    My project photos https://drive.google.com/open?id=0B6...U03X2NyNnp3SEU
    last have arduino mega fsx/x-plane radio panel com/nav 1
    Last edited by masawee; 11-16-2016 at 10:42 PM.

  21. #121
    Junior Member
    Join Date
    Nov 2016
    Posts
    3
    ok, just looking what teensy can buy and there not can buy anythink not have paypal and ebay i glad have all up to 30-40€ wery expensive one chip same prize can buy 2 rasberry pi or 10 arduino board, huh
    cheapen have only teensy 2.0 but have only 12 analog input
    maybe this must orden only
    all 3.X version what i looking ebay have ower 50€ too expensive , who buy if have 10 arduino board cost ?
    same cost can buy better board leo bodnar buox card same cost. ower 50€
    and have ready to use no need burn own code.
    were can buy cheapen 3.X version ??? i no have money vaste lot.
    normal good prize have one board about 10€
    maybe better i forget all teensy because not have any better than all arduino mega boards but expensive lot.

  22. #122
    Junior Member
    Join Date
    Nov 2016
    Posts
    1
    Quote Originally Posted by PaulStoffregen View Post
    In case anyone else is following this Joystick thread, here's the latest code for Teensy 3.1. Just replace these 4 files in hardware/teensy/cores/teensy3 and your joystick will become 128 buttons, 6 axes, 17 sliders and 4 hats.
    Hi.. I'm new in this forum, I'm looking for hardware that have so many botton and analog... I found this forum. but I dont know why, I can not download those file that you give...
    is it still possible for me to ask those files (again).
    thanks.

    nb. sorry poor english..

  23. #123
    Junior Member
    Join Date
    Jan 2017
    Posts
    1
    Hi,
    is there a way to accomplish the whole thing in the latest version of Teensyduino?
    Last edited by Rolli.Berry; 01-25-2017 at 06:59 PM.

  24. #124
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,576
    Ok, I've updated this code and merged it into the official core library.

    https://github.com/PaulStoffregen/co...e4114bf6e767fa

    If you want to play with it now, you can get the updated files from github and put them into your copy of Arduino. Starting with 1.36-beta2 they will always be there by the installer.

    To actually use this (after you have the new files installed), edit usb_desc.h. Change JOYSTICK_SIZE from 12 to 64. Remember, there's 4 copies for the different USB Types which use joystick. Edit the one you need, or all of them if unsure. I've set everything else to automatically adapt.

    As always, on Windows your old USB device detection might be cached in the Windows Registry. You might need to increase the BCD version number or change the product ID or do other stuff to get Windows to re-detect the device.

  25. #125
    Junior Member
    Join Date
    Sep 2015
    Posts
    3
    Quote Originally Posted by PaulStoffregen View Post
    Change JOYSTICK_SIZE from 12 to 64.
    What about the 128 buttons from the original version?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •