Guys i wrote the Code, Here // define pins #define BLUE 3 #define GREEN 5 #define RED 6 #define button 2 // define color mode int mode = 0; void setup() { // setup LED lights pinMode(RED, OUTPUT); pinMode(GREEN, OUTPUT); pinMode(BLUE, OUTPUT); //setup buttons pinMode(button, INPUT_PULLUP); } void loop() { if (digitalRead(button) == LOW) { mode = mode + 1; delay(400); } // off if (mode == 0) { analogWrite(BLUE, 0); analogWrite(GREEN, 0); analogWrite(RED, 0); } // White if (mode == 1) { analogWrite(BLUE, 225); analogWrite(GREEN, 225); analogWrite(RED, 225); } // Red if (mode == 2) { analogWrite(BLUE, 0); analogWrite(GREEN, 0); analogWrite(RED, 225); } // Orange if (mode == 3) { analogWrite(BLUE, 0); analogWrite(GREEN, 75); analogWrite(RED, 225); } // Yellow if (mode == 4) { analogWrite(BLUE, 0); analogWrite(GREEN, 220); analogWrite(RED, 225); } //Green if (mode == 5) { analogWrite(BLUE, 0); analogWrite(GREEN, 225); analogWrite(RED, 0); } //Blue if (mode == 6) { analogWrite(BLUE, 225); analogWrite(GREEN, 0); analogWrite(RED, 0); } // Violet if (mode == 7) { analogWrite(BLUE, 225); analogWrite(GREEN, 0); analogWrite(RED, 100); } // Switch off if (mode == 0) { mode = 0; } }
@tocosbaby9 ай бұрын
Life saver
@NuzrathSir7 ай бұрын
how nice of you,,,!! lovely
@abusekak19344 ай бұрын
for anyone that cant really copy paste and want a simpler version, (im experienced with 4 years coding), here is a way simpler version written by me (its actually is more advanced and has way more colors but is easier to write) #define blue 3 #define green 5 #define red 6 int mode = 0; void setup() { pinMode(red, OUTPUT); pinMode(green, OUTPUT); pinMode(blue, OUTPUT); } void loop() { int bluevalue = random(1, 500); int redvalue = random(1, 500); int greenvalue = random(1, 500); analogWrite(blue, bluevalue); analogWrite(red, redvalue); analogWrite(green, greenvalue); delay(400); }
@abusekak19344 ай бұрын
ok ye i forgot to remove the: *int mode = 0* but u can type it or skip it either way it will still work
@ctto9525Ай бұрын
my hero
@matchesbattlefield884014 күн бұрын
This is great! clear and insightful. My only concern is that it overemphasises the placement of the button as something that is essential, when other placements can work, but that's only a minor gripe. Great video!
@codymagasich80517 ай бұрын
For everybody here saying this code did not work for them. Check your RBG LED and ensure it is a common cathode and not a common anode. I had the same issue and when I installed the correct RGB LED it worked perfectly
@BrosifStalin7 ай бұрын
Then how do u make it work with a anode pin RGB LED
@codymagasich80517 ай бұрын
@@BrosifStalin it’s a completely different circuit for a common anode. I’m not an expert on them but you could probably find circuit diagrams online to compare the two. I just purchased the common cathodes when I realized that was the problem
@babalolamichael11234 жыл бұрын
great job! but can you share your arduino code used for this project????
@abusekak19344 ай бұрын
use mine *it has way more colors and is way more advanced. but simpler to write if u dont have copy paste* #define blue 3 #define green 5 #define red 6 void setup() { pinMode(red, OUTPUT); pinMode(green, OUTPUT); pinMode(blue, OUTPUT); } void loop() { int bluevalue = random(1, 500); int redvalue = random(1, 500); int greenvalue = random(1, 500); analogWrite(blue, bluevalue); analogWrite(red, redvalue); analogWrite(green, greenvalue); delay(400); }
@MALGAPOVANRAILYR2 ай бұрын
for all who wondering that this code is not working your wrong just debug the if (mode == 0) in the end of the code and replace the zero and input 8 if (mode == 8) and it works just watch and focus to the end of the vid 5:17
@justb4lboa23 Жыл бұрын
This tutorial was very helpful for me! I wasn't really understanding arduino push button stuff and this helped me a lot! Thank you!
@Bansheekilr11 ай бұрын
This is exactly what I was looking for! Thanks 🙏
@MrBobWareham2 жыл бұрын
I know you don't want to share your code, but it would help if you made the text on screen bigger, so we could follow along
@zanejr.29463 жыл бұрын
This tutorial really did merged with my ideas, liked it brother.👍😁
@Prubotics10 ай бұрын
Very clear and extremely useful at this point.
@michaeldeloso90429 ай бұрын
How may I set the led to super slow changing colors such as 10 seconds delay transition colors of rgb and switch automatically to music reactive mode when there is playing music or songs on my videoke and turn back automatically to super slow changing colors of red green blue when there's no music playing or in standby mode?
@FishFingers764Ай бұрын
u can do something like analogWrite(BLUE, 225); analogWrite(GREEN, 0); analogWrite(RED, 100); delay(10000); analogWrite(BLUE, 121); analogWrite(GREEN, 42); analogWrite(RED, 32); i think
@plamenyankov8476Ай бұрын
beautiful and clear explanation, thx!
@destinyirorere44483 ай бұрын
Very underrated youtuber 😢 I hope you get more subs and create more videos
@MH_Bikes4 ай бұрын
Well done, clear instructions, and helpful. Thank you.
@wandersonsilva-fx1cs3 жыл бұрын
simple, but very good! I liked your class. Thanks
@anuragnayak32410 ай бұрын
Why can't we connect a single resistor to the cathode? I am going to do that...
@EnderKnigh Жыл бұрын
wait it keeps saying pinmode not defined or something like that?
@noneofyourbusinesssokemydi46583 жыл бұрын
really good project but for some reason it did'nt work for me
@TheReal_IHR7 ай бұрын
Same
@trashboy32573 жыл бұрын
Please share the code
@SiNNeR90737 Жыл бұрын
Cam someone help me with this issue I'm having. I want to put leds on a switch box for back lighting but I want the led the change color when the switch is on. Someone please help me out with this. I would highly appreciate the help..
@gordsh13 жыл бұрын
PLEAS SHARE THE CODE
@abusekak19344 ай бұрын
use mine! *it has way more colors and is way more advanced/simple to write. u can copy paste mine*: #define blue 3 #define green 5 #define red 6 void setup() { pinMode(red, OUTPUT); pinMode(green, OUTPUT); pinMode(blue, OUTPUT); } void loop() { int bluevalue = random(1, 500); int redvalue = random(1, 500); int greenvalue = random(1, 500); analogWrite(blue, bluevalue); analogWrite(red, redvalue); analogWrite(green, greenvalue); delay(400); }
@ohnobo143 күн бұрын
@@abusekak1934I just ran your code myself and it works PERFECT! Thank you so much for solving my problem. You are amazing.
@steam_man3765 Жыл бұрын
Can you pls give me code because mine is not working
@emilianomartinez80362 жыл бұрын
How can I make the LED take less time to change color?
@arjunj7540 Жыл бұрын
you can do it by reducing the delay time in code
@abusekak19344 ай бұрын
here is a simple version (works kind off the same): #define blue 3 #define green 5 #define red 6 int mode = 0; void setup() { pinMode(red, OUTPUT); pinMode(green, OUTPUT); pinMode(blue, OUTPUT); } void loop() { int bluevalue = random(1, 500); int redvalue = random(1, 500); int greenvalue = random(1, 500); analogWrite(blue, bluevalue); analogWrite(red, redvalue); analogWrite(green, greenvalue); delay(400); } //YES i wrote this
@noaht91848 ай бұрын
This was perfect, thank you SO much
@Tech.Explorer.X Жыл бұрын
can anyone let me know what is wrong with this code i copied the exact coding from the video i rechecked it but there is still errors on it my code| | | v // define pins #define Blue 3 #define Green 5 #define Red 6 #define button 2 // define color mode int mode = 0; void setup() { //setup LED lights pinMode(RED, OUTPUT); pinMode(GREEN, OUTPUT); pinMode(BLUE, OUTPUT); // setup buttons pinMode(button, INPUT_PULLUP); } void loop() { if (digitalRead(button) == LOW) { mode = mode + 1; delay(400); } // off if (mode == 0) { anaLogWrite(BLUE, 0); anaLogWrite(GREEN, 0); anaLogWrite(RED, 0); } // White if (mode == 1) { anaLogWrite(BLUE 255); anaLogWrite(GREEN, 255); anaLogWrite(RED, 255); } // Red if (mode == 2) { anaLogWrite(BLUE, 0); anaLogWrite(GREEN, 0); anaLogWrite(RED, 255); } // Orange if (mode == 3) { anaLogWrite(Blue, 0); anaLogWrite(GREEN, 75); anaLogWrite(RED, 255); } // Yellow if (mode == 4) { anaLogWrite(BLUE, 0); anaLogWrite(GREEN, 220); anaLogWrite(RED, 255); } // Green if (mode == 5) { anaLogWrite(BLUE, 0); anaLogWrite(GREEN, 255); anaLogWrite(RED, 0); } // Blue if (mode == 6) { anaLogWrite(BLUE, 255); anaLogWrite(GREEN, 0); anaLogWrite(RED, 0); } // Violet if (mode == 7) { anaLogWrite(BLUE, 255); anaLogWrite(GREEN, 0); anaLogWrite(RED, 100); } // Switch Off if (mode == 8) { mode = 0; } }
@j0hnk120 Жыл бұрын
Hello, The biggest problem is that you put in #define red,green and blue instaed of RED,GREEN and BLUE (the capital letters make a differrence).Also you had little mistakes in your code like not using "," before color and stuff.Here is your code #define BLUE 3 #define GREEN 5 #define RED 6 #define button 2 int mode = 0; void setup() { pinMode(RED, OUTPUT); pinMode(GREEN, OUTPUT); pinMode(BLUE, OUTPUT); pinMode(button, INPUT_PULLUP); } void loop() { if (digitalRead(button) == LOW) { mode = mode + 1; delay(400); } if (mode == 0) { analogWrite(BLUE, 0); analogWrite(GREEN, 0); analogWrite(RED, 0); } // White if (mode == 1) { analogWrite(BLUE, 255); analogWrite(GREEN, 255); analogWrite(RED, 255); } // Red if (mode == 2) { analogWrite(BLUE, 0); analogWrite(GREEN, 0); analogWrite(RED, 255); } // Orange if (mode == 3) { analogWrite(BLUE, 0); analogWrite(GREEN, 75); analogWrite(RED, 255); } // Yellow if (mode == 4) { analogWrite(BLUE, 0); analogWrite(GREEN, 220); analogWrite(RED, 255); } // Green if (mode == 5) { analogWrite(BLUE, 0); analogWrite(GREEN, 255); analogWrite(RED, 0); } // Blue if (mode == 6) { analogWrite(BLUE, 255); analogWrite(GREEN, 0); analogWrite(RED, 0); } // Violet if (mode == 7) { analogWrite(BLUE, 255); analogWrite(GREEN, 0); analogWrite(RED, 100); } // Switch Off if (mode == 8) { mode = 0; } }
@ohnobo143 күн бұрын
If you dont want the RGB cycling through colors and you want a geniune RGB pulse here is a code with 5 different options that works with the above setup: // define pins #define BLUE 3 #define GREEN 5 #define RED 6 #define button 2 // define color mode int mode = 0; // 0 = off, 1 = pulsing, 2 = reset to off // Variables for pulsing effect int pulseValue = 0; // Variable to control pulse intensity (0 to 255) int pulseDirection = 1; // 1 for fading in, -1 for fading out void setup() { // Set RGB LED pins as OUTPUT pinMode(RED, OUTPUT); pinMode(GREEN, OUTPUT); pinMode(BLUE, OUTPUT); // Setup button pin pinMode(button, INPUT_PULLUP); } void loop() { // Check if the button is pressed (LOW means pressed, as we use INPUT_PULLUP) if (digitalRead(button) == LOW) { // Wait a short time to debounce the button press delay(300); // Increment the mode (1st press: pulsing, 2nd press: reset to off) mode = mode + 1; // If mode reaches 3, reset to mode 0 (off) if (mode > 2) { mode = 0; } } // Mode 0: LEDs off if (mode == 0) { analogWrite(BLUE, 0); analogWrite(GREEN, 0); analogWrite(RED, 0); } // Mode 1: Fade in and out (pulsing effect) if (mode == 1) { if (pulseDirection == 1) { pulseValue += 5; // Increase brightness if (pulseValue >= 255) { pulseDirection = -1; // Change direction to fading out } } else { pulseValue -= 5; // Decrease brightness if (pulseValue = 255) { pulseDirection = -1; // Change direction to fading out } } else { pulseValue -= 5; // Decrease brightness if (pulseValue = 255) { pulseDirection = -1; // Change direction to fading out } } else { pulseValue -= 5; // Decrease brightness if (pulseValue = 255) { pulseDirection = -1; // Change direction to fading out } } else { pulseValue -= 5; // Decrease brightness if (pulseValue = 100) { pulseDirection = -1; // Change direction to fading out } } else { pulseValue -= 5; // Decrease brightness if (pulseValue
@kevinfailpn8891 Жыл бұрын
puedes ayudar con el codigo
@manoshraam54779 ай бұрын
It wad realy helpful
@boomer97739 ай бұрын
here is code i write it //define pins #define BLUE 6 #define GREEN 3 #define RED 5 #define button 2 //define color mode int mode = 0 ; void setup() { pinMode(RED, OUTPUT); pinMode(GREEN, OUTPUT); pinMode(BLUE, OUTPUT); pinMode(button, INPUT_PULLUP); } void loop() { if (digitalRead(button) == LOW){ mode = mode + 1 ; delay(400); } //off if (mode == 0){ analogWrite(BLUE, 0); analogWrite(GREEN, 0); analogWrite(RED, 0); } //White if (mode == 1){ analogWrite(BLUE, 255); analogWrite(GREEN, 255); analogWrite(RED, 255); } //Red if (mode ==2){ analogWrite(BLUE, 0); analogWrite(GREEN, 0); analogWrite(RED, 255); } //blue if (mode == 3){ analogWrite(BLUE, 255); analogWrite(GREEN, 0); analogWrite(RED, 0); } //orange if (mode == 4){ analogWrite(BLUE, 0); analogWrite(GREEN, 75); analogWrite(RED, 255); } //White if (mode == 5){ analogWrite(BLUE, 255); analogWrite(GREEN, 255); analogWrite(RED, 255); } //Violet //White if (mode ==6){ analogWrite(BLUE, 255); analogWrite(GREEN, 0); analogWrite(RED, 100); } //switch off //White if (mode == 7){ mode = 0; } }
@abusekak19344 ай бұрын
use mine: *it has way more colors than this childrens toy code*: #define blue 3 #define green 5 #define red 6 void setup() { pinMode(red, OUTPUT); pinMode(green, OUTPUT); pinMode(blue, OUTPUT); } void loop() { int bluevalue = random(1, 500); int redvalue = random(1, 500); int greenvalue = random(1, 500); analogWrite(blue, bluevalue); analogWrite(red, redvalue); analogWrite(green, greenvalue); delay(400); }
@techparistech26593 жыл бұрын
Good job 👍
@yousufmohideen52434 жыл бұрын
Very Interesting!!
@none97163 жыл бұрын
Send code
@abusekak19344 ай бұрын
use mine.. *it has way more colors*: #define blue 3 #define green 5 #define red 6 void setup() { pinMode(red, OUTPUT); pinMode(green, OUTPUT); pinMode(blue, OUTPUT); } void loop() { int bluevalue = random(1, 500); int redvalue = random(1, 500); int greenvalue = random(1, 500); analogWrite(blue, bluevalue); analogWrite(red, redvalue); analogWrite(green, greenvalue); delay(400); }
@lehuuuc33414 жыл бұрын
love your video
@krythnx248 ай бұрын
I have a problem tho... I need to program 2 rgb led lights and they are expected to function like traffic lights signals... can anybody send help?😅 I need rgb led 1 (red light) to light up together with rgb led 2 (green light)... thing is they should have different durations ... though they lighted up together, they should turn off on different time durations. The rgb led 1 should light up for 15 secs and the rgb 2 should light up for 12 secs. Please help
@FishFingers764Ай бұрын
u can just use red and green led instead of rgbs and do something like #define red 3 #define green 4 void setup() { pinMode(red, OUTPUT); pinMode(green, OUTPUT); } void loop () { digitalWrite(green, LOW); digitalWrite(red, HIGH); delay(15000); digitalWrite(red,LOW); digitalWrite(green,HIGH); dealy(12000); }
@Ren-gr1me3 жыл бұрын
where is the code........??? thats like one of the most essential parts?
Please note that in the mode OFF if (mode == 1) this should be 0 not 1 . As 1 is for white. as shown underneath. //OFF if (mode == 0) { analogWrite(BLUE, 0); analogWrite(GREEN, 0); analogWrite(RED, 0); } all work fine after except the after the last colour it does not switch off and after another pulse it should go back to the first colour. Please can you check and let us know. Thank you beforehand.
@chbonnici2 жыл бұрын
to solve the problem at the end add this and all works fine. //SWITCH OFF if (mode==8){ mode=0; } }
@Sizzlik3 ай бұрын
The longest leg on an RGB LED is NOT the Cathode..nor the Anode. Its the COM for common. As it can be either a common/shared Anode or a Cathode..that depends on the LED you bought..both available. And on everyday LED or other diodes or polarized capacitors, the longest is the Anode(+). Dont make tutorials, if you teach bullshite.
@jejejejeje14 Жыл бұрын
ASANG ANG CODEEEEEEEEEEEEEEee
@abusekak19344 ай бұрын
#define blue 3 #define green 5 #define red 6 void setup() { pinMode(red, OUTPUT); pinMode(green, OUTPUT); pinMode(blue, OUTPUT); } void loop() { int bluevalue = random(1, 500); int redvalue = random(1, 500); int greenvalue = random(1, 500); analogWrite(blue, bluevalue); analogWrite(red, redvalue); analogWrite(green, greenvalue); delay(400); }