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

Thread: Teensy Joystick Complete edit

  1. #1
    Junior Member
    Join Date
    Jun 2020

    Teensy Joystick Complete edit

    Hi all,

    I am currently in the process of designing a flight switch box (using a Teensy 3.6), using the complete joystick example as a base.
    My question is, how do I go about setting 12 pins (0-12 for example) as digital outputs so I can control 6 RGB LEDs to use as switch position indicators?
    I only need 12 pins for the RGB LEDs as I will not be using the blue pin only the red and green.

    The overall setup will have the following;
    1 axis slider (needing 1 analogue pin)
    1 4 position rotary switch with green statues leds showing with position the switch in on, wired in series to reduce the needed pins (needing 4 digital input pins)
    14 push buttons (needing 14 digital input pins)
    6 on-on toggle switches (needing 12 digital input pins)
    6 RGB LEDs (needing 12 digital output pins)

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Hi and welcome:

    How to setup pins 12 pins as output, Not sure in your example for 12 pins if you want 0-11 or 1-12... Assuming 0-11:

    Could do with a simple for loop:

    for (uint8_t pin = 0; pin < 12; pin++) pinMode(pin, OUTPUT);
    Could do as individual calls:
    pinMode(0, OUTPUT);
    pinMode(1, OUTPUT);
    pinMode(11, OUTPUT);

  3. #3
    Junior Member
    Join Date
    Jun 2020
    Thank you for your help.

    I got it working using the second method and in the process forgot how to wire a simple push button to test it, but after much swearing and threatening of my bread board it works.

Posting Permissions

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