Teensy Joystick Complete edit

Status
Not open for further replies.

Beserker

Member
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)
 
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:

Code:
for (uint8_t pin = 0; pin < 12; pin++) pinMode(pin, OUTPUT);

Could do as individual calls:
Code:
pinMode(0, OUTPUT);
pinMode(1, OUTPUT);
...
pinMode(11, OUTPUT);
 
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.
 
Status
Not open for further replies.
Back
Top