Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Joystick and lights

  1. #1
    Junior Member
    Join Date
    Jun 2017
    Posts
    6

    Joystick and lights

    Hi what I'm hoping to do is build a custom joystick that also has a few LED's integrated as well. I'm wondering if I can accomplish this with a single Teensy 3.5. I am able to load in the Complete Joystick example and the joysticks and buttons work as they are supposed to. I can separately wire up the LED's (neopixels) and upload a different sketch and the LED's will work. However I can't seem to use both the Joystick sketch and NeoPixel sketch at the same time. Meaning I can't seem to put both sketches into one and upload to the teensy.

    I'm using the normal pins outlined in the example sketch for the joystick, and would be using pin 13 (not used by the joystick) for the LED's. I don't know it if has anything to do with switching the port, (LED NeoPixels sketch needs to be set to serial, Joystick needs to be set to USB Joystick). probably not.

    Thanks.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,556
    This really ought to be able to work.

    Quote Originally Posted by toddhacker View Post
    However I can't seem to use both the Joystick sketch and NeoPixel sketch at the same time. Meaning I can't seem to put both sketches into one and upload to the teensy.
    Would you like us to try helping you resolve whatever's wrong?

    From your message, I can't even deduce what the problem is, only that it doesn't work. Can't even tell if you get a compile error, or some part works and other parts don't work.

    Maybe you could describe the problem in more detail?

    We can also do so much more to help when you copy the complete code into your message (see the "forum rule" with red text at the top of the forum). Often things don't work because of a simple mistake or misunderstanding, but how can we help you resolve such a problem if we don't see the actual code?

  3. #3
    Junior Member
    Join Date
    Jun 2017
    Posts
    6
    Apologies, I'm at work and don't have the error in front of me. I can post that later this evening. I guess on a basic level I was wondering if the premise is possible to use 1 teensy 3.5 for both the Joystick and LED controls or if there is some limitation that negates using one over the other.

  4. #4
    Junior Member
    Join Date
    Jun 2017
    Posts
    6
    Ok, I've not had a chance to hookup and test the joystick yet, but I did resolve some issues. First I had some of the LED function outside of my main loop so that was one issue. The second and main problem I was running into that I corrected I had previously been using the USB type serial when doing my LED tests and USB type Keyboard Joystick Mouse when testing the Joystick code. When I tried to compile and upload using that second USB type I was getting some errors. The correction I made was to select USB type "Serial, Keyboard, Joystick, Mouse". That allowed me to compile and upload to the teensy with no issues. The LED's worked correctly, I've not been able to plugin the joystick to verify that is functioning correctly, but I'm hopeful that it should be working.

    So if anyone out there is looking for a similar solution, make sure you check the simple stuff first, and that you're using the correct USB selection.

Posting Permissions

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