im currently trying to make a tic tac toe game in tinkercad where player 1 would lets say have the color blue and player 2 would be red so you can see who played what. is it possible to connect the red,blue and gree pin of the rgb led into a single pin so it can somehow switch colors depending on which player made that move? or would i need to add something else to make this work? if so what?
Draw out a schematic. You will see the RGB led is the equivalent of a red, a green and a blue led with a com line
You can connect 2 color LEDS to a single pin. One lights on low, one on high, and none on input.
i am working in tinkercad so im using the single rgb led could that work as well?
A rgb led is just 3 leds smooshed into 1 housing.
Draw a schematic of what you intend to do.
if this is what you meant by schematic.hopefully this shows what im trying to do. the led switches colors based on input
That is a fritzing picture which is not very good. Pencil and paper is better or use an online free schematic software like Kicad or Easyeda.
You have no resistors connected and 2 of the leds legs are connected to one pin so you will turn on 2 colours at once
https://create.arduino.cc/projecthub/muhammad-aqib/arduino-rgb-led-tutorial-fc003e
im sorry im pretty new to all this
If you only need 2 colours you don’t need the third leg
You need a 3x3 matrix of each led colour. That needs 18 pins if doing it in a simple way like you have demonstrated. There are other ways of driving a matrix from less pins or using another component to get more IOs from your arduino
alright thank you!
Do you really need to save pins? Why? Can't you just connect a pin to each leg of the LED and alternate the pin output values, to get the colour you want?
There are two pin bidirectional LED's. Drive 'em high you get get one color, drive low get the other, float input is off. You can also just wire two different led's back to back
Can you use something like this?
I wanted to make like a tic tac toe game with it and each led lit up one of 2 colors based on player but i dont think thats possible with the stuff i have in tinkercad
Im doing it in tinkercad so i only have the basic led and the rgb one with 4 pins
You still haven't answered my question.
In a 3x3 board, you would have 9 RGB LEDs or 27 LEDs total. You could use 12 pins to make a 3x9 or 9x3 matrix.
Or you could use addressable RGB LEDs like the NeoPixel to do all nine LEDs with one pin.
My simple answer: a (digital) pin has just 0 and 1 as possible values.
For RBG you need 3 bits, all separate as 0 and 1.
How can it work? (for RGB 3 independent bits are needed, all as 0 or 1)
Yes, you can make use of a bi-color LED: 0 is one color, 1 is another color (e.g. using an anti-parallel LED). With one bit - only two states possible - so, a bi-color LED possible.
But RBG is 3 bits (and for all colors you need all 3 bits in any combination).
Cannot work.
You can use an "RGB LED stripe" and you generate the waveform to send the patterns for different colors (e.g. as Single Wire Interface, SWI, signal looks like a PWM).
With an LED stripe and SWI you need just one pin. But the pin generates a complex pattern to specify which color and which LED should be on at the stripe.
Bi-directional (two pin) LEDs need two GPIOs, being connected between them (one is HIGH, the other is LOW).
A bi-dir connected between one GPIO and GND can only light one, same if it's connected between the GPIO and 5V.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
