Y
Y
Yan Nesterov2018-11-09 11:10:39
Arduino
Yan Nesterov, 2018-11-09 11:10:39

Driving LEDs with two pins?

How to connect three LEDs to ARDUINO via two pins and turn on/off each of them independently?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Antony, 2018-11-09
@RiseOfDeath

Depends on how strictly to follow the task statement. You can connect some driver via I2C (as Alexander advises).
You can buy a regular 2 to 4 decoder and just blink the LEDs in turn. If you do this very quickly, you will not see that they are blinking (visually, it will not have time to go out).
The first method is better because you can hang many, many devices on one I2C bus (not just your LED controller) and it is simpler in terms of programming. The second one is better because any two GPIOs and a decoder will go cheaper, but you will have to make a more complex program on an arduino.

A
Alexander, 2018-11-09
@NeiroNx

I2C I/O device type PCF8574

I
Ilia_K, 2018-11-12
@Ilia_K

Easily.
Here is the diagram:
https://yadi.sk/i/GzClHuh3zrlSpQ
control is obvious. power supply + 3.3v.
R1 and R2 are chosen so that with ONE
low level at the output, LED3 does not light, but
only burns with TWO zeros.

A
alexhott, 2018-11-19
@alexhott

On 2 pins, you can connect 4 LEDs and control all 4-I
will look like independently.
Search Google for "2 LEDs per output" there are diagrams and code.
Briefly, we hook two LEDs to one output: One is the anode of the other cathode. The second conclusions of the LEDs through resistors, respectively, one to + the other to -.
The output is configured as an input - the LEDs are off.
Output output \u003d 0 - one is on, 1 - the other is on, quickly change the state (0-1-0-1-0 ....) - both are on

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question