Excuse the noob engineering question.
I'd like to drive both a Trinket GPIO and the input pin for an ATXRaspi from a single switch. I'm assuming these should be isolated to be safe. Is an optoisolator the best choice, or would a pair of diodes do the job?
One switch >two microcontroller GPIOs?
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- michaelmeissner
- Posts: 1832
- Joined: Wed Aug 29, 2012 12:40 am
Re: One switch >two microcontroller GPIOs?
I don't think Adafruit stocks it, but you might want to look for a "double pull double throw" switch. This switch has two independent connections, so you could hook the trinket to one side and the Raspberry Pi.
For example: http://www.futureelectronics.com/en/tec ... .aspx?IM=0
For example: http://www.futureelectronics.com/en/tec ... .aspx?IM=0
- datac
- Posts: 8
- Joined: Tue Feb 16, 2016 2:07 am
Re: One switch >two microcontroller GPIOs?
I'm familiar with those, and that would save some hassle, but I need to drive this from a single switch (the push function of an Adafruit rotary encoder, to be specific).
If I were doing caveman engineering I'd fire a DPDT relay with the switch, but that seems like overkill designed to hide my ignorance of proper electrical design. I assume there's a simple MOSFET or other solid state equivalent, if I knew what it was or how to use it.
If I were doing caveman engineering I'd fire a DPDT relay with the switch, but that seems like overkill designed to hide my ignorance of proper electrical design. I assume there's a simple MOSFET or other solid state equivalent, if I knew what it was or how to use it.
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: One switch >two microcontroller GPIOs?
You can use a couple of transistors per output:
The two-inverter step from the switch to the GPIO pin makes the signal at the pin match the signal at the switch. If you don't mind reversing your logic, you can eliminate the first transistor in either path.
The two-inverter step from the switch to the GPIO pin makes the signal at the pin match the signal at the switch. If you don't mind reversing your logic, you can eliminate the first transistor in either path.
Please be positive and constructive with your questions and comments.