Тёмный

Arduino Tutorial 20: Understanding RGB LED's 

Paul McWhorter
Подписаться 382 тыс.
Просмотров 161 тыс.
50% 1

You guys can help me out over at Patreon, and that will keep this high quality content coming:
/ paulmcwhorter
In this lesson we learn how to control an RGB LED from an arduino. We show how to not only get the primary colors but also how to mix colors on the RBG LED. Enjoy!
You can get the following Elegoo kit, to follow these lessons and play along at home
amzn.to/3c9SJrO
You can follow along on our WEB site at:
toptechboy.com...
[Disclosure of Material Connection: I am a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com. This means if you visit the link and purchase the item, I will receive an affiliate commission. Regardless, I only recommend products or services I use personally and believe will add value to my readers.]
#Arduino

Опубликовано:

 

13 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 858   
@jasonchristopher450
@jasonchristopher450 5 лет назад
I have been following your tutorials since 2016, and I have never realized until now that you are the person that sparks my curiosity. You teach me computer programming, mathematics, electronics, and the science of how things work. Looking back, I can see how much I know because of you. Paul, you are the greatest teacher I ever have and for that, I just want to say thank you. And I can't wait for the 9-axis sensor tutorial. :)
@rolstonholas333
@rolstonholas333 5 лет назад
Thanks for the shout out for the UK viewers, there seems to be quite a few of us. Keep up the good work PW
@jayjay_yah
@jayjay_yah 4 года назад
Remember to have the serial monitor set for "No Line Ending "
@shuttlepodone1707
@shuttlepodone1707 4 года назад
Good reminder! On the web based version of the Arduino Editor this setting is at the top left to the left of the baud rate drop down.
@alexcork6986
@alexcork6986 4 года назад
wish I had looked at this comment an hour ago!!!!! =-)
@slightlyarrogant
@slightlyarrogant 4 года назад
I spent like 90 minutes to discover what was wrong; Yes indeed I wish I looked at your comment a bit earlier
@wallaceshackleton1889
@wallaceshackleton1889 4 года назад
Once bitten, twice shy.
@Yrael55555
@Yrael55555 4 года назад
fell for this - using VScode as my editor so didn't think to check. Doesn't look like you can change it yet either 🤦‍♂️
@robjameson7965
@robjameson7965 4 года назад
Most excellent "behavioUr" for the English spelling!
@Large_Woman
@Large_Woman 3 года назад
20 lessons in, and "hook a brother up" still makes me grin from ear to ear. ^o^
@peterdr8726
@peterdr8726 2 года назад
Hi Paul, thanks for the arduino lessons, I've never had a better teacher ! I am a retired electronics engineer , and enjoy the modern arduino applications , thanks to you! Peter, Belgium
@paulmcwhorter
@paulmcwhorter 2 года назад
Fantastic!
@MardinBodley
@MardinBodley Месяц назад
Same as Peter
@danthelinuxman
@danthelinuxman Год назад
Im British and enjoying you lessons !!
@ryanm5291
@ryanm5291 2 года назад
I made it to tutorial 20! I'm really good about getting excited about something then quickly losing interest. I'm proud of myself! There is nothing more exciting then starting a fresh new lesson (with my black iced coffee) and pulling something new out of my kit! Never thought in a million years I'd be spending my Saturday nights doing something like this but I've never been happier!
@paulmcwhorter
@paulmcwhorter 2 года назад
EXCELLENT! You are almost 1/3 of the way through the class. Then off course, lots of other videos series on this channel, so plenty to keep you buys. I can not think of a more fun way to spend Saturday night, and the great thing is you get up Sunday morning feeling great. Keep up the good work.
@ryanm5291
@ryanm5291 2 года назад
@@paulmcwhorter exactly on point about feeling great Sunday morning! I’m a recovering alcoholic with 5 years of sobriety so it’s hobbies like this that keep my brain in the right place. Noticed all your playlists so I’ll have to look into what else I can learn from you. Probably need to hit up your Patreon too!
@timbrooker8630
@timbrooker8630 2 года назад
Ryan, I've tried the RGB LED chapter. I can't get it to work. I know my code is correct. I've also tried switching resistors, RGB LEDs, and rewired my circuit more than a few times. Any suggestions.
@FurkanOz480
@FurkanOz480 Год назад
@timbrooker8630 maybe i think i had it too u should try to see if the connections are good and olso if u plan to lets say give a certain amount like red 50 do it on a port with the ~ then u can do analogwrite or som and olso try to see if u can light up the individual by instead of puting it on an output but the lead that was to the output to 5v to see if it brightens up or not then u can diagnose and olso maybe your resistor is wrong or not connected properly or maybe u forgot a capital in de code maybe idk
@johnnymnemonic3461
@johnnymnemonic3461 Год назад
@@FurkanOz480Thank you for help. I have the same problem. Tried all the suggestions, found that the declaration of STRING doesn t change it s color, maybe the syntax is different for the newest version 2.0.3. that i use.
@shorifulhaque5137
@shorifulhaque5137 4 года назад
I deeply appreciate the 'u' in 'colour.' More than you could ever know. Thanks, Paul.
@FuNkT0iD
@FuNkT0iD 3 года назад
For anyone who is working through this most excellent tutorial - please make sure you adjust your Serial input to "No line ending" otherwise the conditional statements here won't fire. Aside from that, this is 10/10 awesome! Thank you Paul McWhorter! :)
@thefederalbureauofinvestig496
I have been banging my head for a day trying to get it to work and this did it thanks
@adhyayansonthalia1422
@adhyayansonthalia1422 Год назад
Thankuuuuuuuuu!!!!
@andrewlambdin8568
@andrewlambdin8568 11 месяцев назад
Much appreciated. This was driving me crazy
@neverythingk3270
@neverythingk3270 10 месяцев назад
how to do it can you tell me please i am banging my mind from long time
@Ricky-kw2in
@Ricky-kw2in 10 месяцев назад
I was having so much trouble getting it to work but I had it on new line all the time, thanks for the tip, it finally worked!!
@icuderby5486
@icuderby5486 4 года назад
"Boom" learned some more. Love the UK shout out with "colour"
@stonkyboy7606
@stonkyboy7606 3 года назад
Canadians also use the "u" in colour!
@ShitBrick785
@ShitBrick785 2 года назад
If you are going to use analogWrite be sure to use a pin port that has a "~" next to it
@jonathanmalamy3760
@jonathanmalamy3760 Год назад
I thought he was going to play that out in the lesson. He had green and blue in ~ pins and the red one out (in 8). I imagined we'd try purple and then see what happened if we adjusted red. Anyway, that's what I'll try.
@AlexandrosRex
@AlexandrosRex Год назад
thank you, shyt brick
@mericlre
@mericlre Год назад
You won't use analog pins
@simontopley4771
@simontopley4771 Год назад
I'm using a Elegoo Mega2560, I don't have the ~ all my digital pins 2-13 are screen printed PWM.
@amazinplays7813
@amazinplays7813 3 года назад
I have spent two days trying to make this work. My serial monitor wasn’t set to “no line ending” . Now it works!!!
@waitwhat612
@waitwhat612 3 года назад
Same, but why ?
@martini1094
@martini1094 3 года назад
@@waitwhat612 you need to set your serial monitor to no line ending
@yamaha893
@yamaha893 Год назад
you've done me a great favour by spelling colour courectly. great episode!
@paulmcwhorter
@paulmcwhorter Год назад
No Proublem
@user-mx4ek3jf8s
@user-mx4ek3jf8s Год назад
Thanks for including us Australians with the spelling of colour. A great series of tutorials.
@dimpledharamsi7704
@dimpledharamsi7704 2 года назад
Hello ! I was very curious to know about this 4-legged LED and I played along with it for a while. I went through the color charts and made CYAN, MAGENTA, YELLOW, WHITE followed by the basic RED , GREEN , BLUE colors. Further out of my curiosity I did a little experiment with 3 potentiometers and the RGB LED. It worked well and I made other beautiful colors such as LAVENDER and ORANGE. Thank you so much for teaching me the fundamentals so well. Blessed to be learning from you!
@baconguy777
@baconguy777 Год назад
Nice idea I am going to do it
@legendarystudios8421
@legendarystudios8421 Год назад
I took a break from Arduino, but I am really happy that I started doing this again. You are the best.
@unclecrusty5476
@unclecrusty5476 3 года назад
Thank you very much for the shout out Paul. I decided to use your parseInt stuff so I could manually set the brightness for my program.
@dukydon
@dukydon 3 года назад
Hi, I also did this however, my blue coluree is way less bright than red and green given the same brightness argument. I tried both RGB leds, swapped current resistors and also swapped pins at the Arduino to no avail. I can try a lessor current resistor but, should I have too??? Any insight would be appreciated! dhrubes@hotmail.com
@kevindegoede9144
@kevindegoede9144 4 года назад
I have been following the lessons and BOOM I have a much better understanding of programming. What has helped is the fact that mistakes are made, whether intentional or unintentional, and that is where I have gained the most because so many are similar to what I've done. Thanks for the lively and informative tuition. I am especially looking forward to reading to and from LCDs. I hope that is in the programme.
@tomroberts3851
@tomroberts3851 Год назад
I did your homework task, then I created three counters and created a light that changes colour constantly, SO COOL!! Thanks so much, I've made it to Tutorial 20 and I'm still LOVING IT!!!
@tomroberts3851
@tomroberts3851 Год назад
PS. I got massively caught out by using pins 11, 12 and 13 before realising I needed to use pins 9,10 and 11 with PWM. Thanks so much for your great content Paul!
@paulmcwhorter
@paulmcwhorter Год назад
PWM is your friend!
@jakubkosior
@jakubkosior 8 месяцев назад
A little remark, to people who might have problems with the diode lighting up. In my case I had to change the condition statements (starting with "if") from f.e.: " if (myColour == "red") ", to " if (myColour == "red ") ", because the Arduino IDE had some problems with interpretation of the new line after each question. Mr. McWorther, your channel was recommended to me by a good friend of mine. I really do love and enjoy your Arduino Tutorial. Please never lose your passion to teaching and your spirit. I am looking forward to watching your future videos ^^.
@Dhananjay_Pandey
@Dhananjay_Pandey 5 лет назад
Hi Mr. Paul ,❣️You From "The India" Your Videos are really Amazing 😍
@prashantgunjal5566
@prashantgunjal5566 4 года назад
me too from india
@tellder1
@tellder1 4 года назад
Age long question "If indian guys teach everything on RU-vid, then who teaches indians?" has finaly been answered! It was our best teacher Paul all along!
@rushipadhiyar2615
@rushipadhiyar2615 3 года назад
@@tellder1 True that
@Anonymous-yy5qr
@Anonymous-yy5qr 3 года назад
@@tellder1 truuu
@madskillz98258
@madskillz98258 3 года назад
RGB BOOM! I decided for my project to use three for loops to make the LED cycle through all the possible colors. It's pretty nice to watch.
@slnuygn
@slnuygn 11 месяцев назад
I've been following this series and playing along, I am eager to learn more and I'm having so much fun! You're the best teacher ever!
@bingosmum1
@bingosmum1 4 месяца назад
“Colour” for us Aussies too. Thank you so much for all these tutorials. The absolute best and easiest to follow.
@ErlankBru
@ErlankBru 5 месяцев назад
I sit and played with these assignment colours... Loved it! Thanks Paul!
@matthewmoore7916
@matthewmoore7916 2 года назад
I would move to Texas just to take a class with him. I LOVE THIS SERIES!
@paulmcwhorter
@paulmcwhorter 2 года назад
Well, I live in Africa now, so you would have to move to Africa.
@matthewmoore7916
@matthewmoore7916 2 года назад
@@paulmcwhorter I would do that, also that’s really cool!
@jadersoares3659
@jadersoares3659 Год назад
Mr. Paul McWhorter is the best teacher ever! God bless
@Rorschachcollision
@Rorschachcollision 10 месяцев назад
As a Canadian, I appreciate the spelling of "colour". These tutorials are brilliant btw!
@luciusrex
@luciusrex 6 месяцев назад
Manitoba represent!
@chrisperrott8781
@chrisperrott8781 4 года назад
Hi Paul, Thanks for the wave to the British :-) Loving the course. Stay safe.
@TheSailingwoodworker
@TheSailingwoodworker 3 года назад
I got sloppy on this one and powered a few of the LEDs with digital pins. Some of the colors worked but the ones that needed one to be dimmed did not work right. After putting them all on the analog outputs they worked great. After 20 episodes I'm still here. 48 more to go! These are awesome videos!
@butchmichaels69
@butchmichaels69 Год назад
It just gets easier! I will now read through the comments before each lesson.
@tretty07
@tretty07 3 года назад
Thanks for the shout out, watching from the UK working my way through this series.
@patrickmachacek894
@patrickmachacek894 3 года назад
Paul McWorthers teaching is so intriguing that i started the combination of lights even before he mentioned it!
@gilnasty82
@gilnasty82 2 года назад
Had issues with this once I started adding the extra colors (the assignment). Realized that pin 8 wasn't an analog pin! Once I switched the pins to 9, 10, and 11, everything worked perfectly!! Hope I'm not spoiling the next lesson for anyone!! I also like adding all "case" versions of the word. Silly since it'll just be me typing in the Serial Monitor, but I guess I'm a little OCD too!! HAHA! Another good lesson Paul!!
@julelippmann5246
@julelippmann5246 Год назад
Thank you soooooo much for your comment! I could not for the life of me figure out why I could not turn on any colour of the LED. Switching pins finally did the trick!
@allensun
@allensun 4 года назад
As someone who learned Canadian English, the "colour" spelling was appreciated! Thanks for the tutorial as always.
@captinkrazy6968
@captinkrazy6968 2 года назад
This is my second time following along with these videos but i changed up the last lesson and used the RGB LED and i added purple to the color options.
@johnsathe2429
@johnsathe2429 2 года назад
I can see "new", I can see "improved", but never "new and improved". Can't be done as it is either new or improved. Not both. These are "most excellent" tutorials. Easy to understand and I'm seeing new things and improving my base. Thanks for these.
@bobbyeakle9511
@bobbyeakle9511 4 года назад
Guys! If the leds aren’t turning on, try turning your serial monitor to no line ending. Hope this helps!
@bobbyeakle9511
@bobbyeakle9511 4 года назад
Thanks for liking Paul! I have tried to find tutorials for arduino online for completely new people but there weren’t really any good complete ones until I found yours! Thanks for the help!
@04fys513
@04fys513 Год назад
? I don't understand that statement. How is this done?
@04fys513
@04fys513 Год назад
I take it back. I figured it out, and it was the cause for the lights not turning on. Thanks!!!!!
@rgchevyy
@rgchevyy Год назад
Most Awesome advice!
@MinhangNguyen-ug8oz
@MinhangNguyen-ug8oz 10 месяцев назад
I did it but it didn't work. I checked all the LEDs and wires and they're fine. I also added println( myColor ) to check my command but when i type "red", the result shows "redred".
@zigzag00
@zigzag00 9 месяцев назад
As a Canadian thank you for using Colour ;)
@muhammadrafiqulislamkhan6994
@muhammadrafiqulislamkhan6994 3 года назад
Paul when you say Hold your breath and let see and then say, Boom. This is such a exciting moment to catch your excitment to see your magic. I am new. Just begin to learn. I become so excited when you do to us in your every new project. Thank you.
@paulmcwhorter
@paulmcwhorter 3 года назад
Love it!
@et4493
@et4493 Год назад
The extent Mr. McWhorter goes to teach us is a delight
@426F6F
@426F6F Год назад
Just thought about how to make the RGB LED cycle between ROY-G-BIV! I had problems with it flickering initially, but I realized that it's because I allowed the values to reach zero (off) and then turn back on at full brightness. There's all the colours for you and then some Paul! Thanks for being a great teacher. Without your lessons I probably wouldn't have even thought about how to do this! int red_pin = 9; int green_pin = 10; int blue_pin = 11; int red_val; int green_val; int blue_val; int delayTime = 5; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(red_pin,OUTPUT); pinMode(green_pin,OUTPUT); pinMode(blue_pin,OUTPUT); } void loop() { // put your main code here, to run repeatedly: for (red_val == 255; green_val < 255; green_val += 1) { analogWrite(green_pin,green_val); delay(delayTime); } for (green_val == 255; red_val > 1; red_val -= 1) { analogWrite(red_pin,red_val); delay(delayTime); } for (red_val == 1; blue_val < 255; blue_val += 1) { analogWrite(blue_pin,blue_val); delay(delayTime); } for (blue_val == 255; green_val > 1; green_val -= 1) { analogWrite(green_pin,green_val); delay(delayTime); } for (green_val == 1; red_val < 255; red_val += 1) { analogWrite(red_pin,red_val); delay(delayTime); } for (red_val == 255; blue_val > 1; blue_val -= 1) { analogWrite(blue_pin,blue_val); delay(delayTime); } }
@426F6F
@426F6F Год назад
I think you could also adjust the max brightness by making it a variable that you adjust with the potentiometer and then making that the initialization and the condition parameters for the for loop, but I'm not sure, going to have to try that in the morning!
@NatureBoy-kk2cv
@NatureBoy-kk2cv 7 месяцев назад
Love the series Paul. I don't have an Arduino as yet but am following. Thanks for the "U" in colour. We spell it that way in Oz. When I get my Ardi I'll do all of the lessons on it. You have an excellent (most excellent?) incremental teaching style. Thanks so much for your work in doing these.
@user-ys6bc7yh7z
@user-ys6bc7yh7z 11 месяцев назад
Thank you very much for an amazing lesson! Had so much fun with the ping-pong ball, and when I turned the light off:"Boom!" It looked great! Changed redPin to ~6. Assignment is completed, but Orange doesn't look really well, although I checked in the internet. Looking forward to the next lessons!
@tpm369
@tpm369 4 года назад
Thank You for not editing out your errors. More importantly, Thank You for talking out loud while you troubleshoot them. I usually pick something up that I did not know/think of from what you said out loud!
@thisguy5279
@thisguy5279 Год назад
You had me going on the red led on the homework. I couldn't trim the red for some reason. Finally figured it out.
@thegringobaker
@thegringobaker 11 месяцев назад
Whew... this one went WAY better than lesson 19. I paused the video and went and coded the exercise (I did glance back at the code for 19 a couple of times) and it worked! I even added a fourth if which lets people know if they entered an unavailable color.
@kageshirou
@kageshirou 3 года назад
I have been learning all your lessons and doing all the homework so far and it is awesome! I'm from Canada so we use "colour" here. Thanks for all the lessons so far.
@theknottyworkshopgeoffjung529
@theknottyworkshopgeoffjung529 4 года назад
Paul, I learned one hell of a lesson! I typed in my code and built my circuit before looking at yours. After debugging the normal stuff, it compiled but would not work. I would type in the color, but no LED would light. I tested the circuit to 5V, and the LEDs lit. I went over the code and it matched yours exactly, except for the variable names. After going over it for nearly an hour, I retyped the code, without using copy and paste. Still the same thing. It turned out to be I did not have "no line ending" selected in the serial monitor. I had remembered you mentioning this in a previous video. Thanks! Love your videos. Geoff Jung
@andrewwhitcombe8155
@andrewwhitcombe8155 4 года назад
Geoff Jung . Mate! thank you. I've been struggling with that exact problem for a couple of hours but didn't go back to the videos. Read your post and BOOM worked. Well done!
@deyanvalkov5129
@deyanvalkov5129 3 года назад
Mate i have spent my whole day today to figure out what the heck i am coding wrong as i had same issue as you . i must have missed this for no line ending i even rewriteed the program instead of asking for colour to ask for number and was playing with j as int from 1 to 3 to make it work ooooo thanks for sharing this mate
@FransSchalkwijk
@FransSchalkwijk 3 года назад
Thanks mate. same problem here. I didn't remember that.
@jamesmcknight2130
@jamesmcknight2130 2 года назад
Thanks dude. i had no idea why my code wasnt working
@tylerswingler5320
@tylerswingler5320 2 года назад
Thanks for your solution. I have been trying to figure this out for days.
@CK-sv8fc
@CK-sv8fc 3 года назад
After doing this tutorial. I made a blinking light with different kinds of colours. it was a long code and its all worth it! I'm very happy!
@marksimpsonUK
@marksimpsonUK Год назад
Hi Paul, thanks for spelling Colour correctly 😀. Also id like to thank you for sharing your time and knowledge in these most excellent videos.
@vgerst8276
@vgerst8276 11 месяцев назад
Thank you @FuNkTOID for pointing out adjust your Serial input to "No line ending" , Spent 3 days trying to figure it out, as well as buying a new Arduino board. After that, everything was good :))
@christopherwhite8453
@christopherwhite8453 4 года назад
Another Brit here loving the acknowledgment and the Arduino Tutorials in general. Thank you 😁😁
@oooivn
@oooivn 2 года назад
G'Day Mate I am loving the tutorial and especially love how you set homework so we can try and figure things out by our selves in small bites. can't wait to continue through the series you have put together.
@JayBee6011
@JayBee6011 2 года назад
I'm British (from Bristol, England). I appreciate the "Colour" gesture, thank you.
@magwitch
@magwitch 2 года назад
Just started watching this series yesterday. I greatly appreciated the "U" in colour! Thanks for the lessons, they've been very helpful for understanding micro-controller code. Cheers from the UK.
@paulmcwhorter
@paulmcwhorter 2 года назад
Welcome aboard!
@hungry8560
@hungry8560 3 года назад
I had a ton of fun playing with the colors!
@paulmcwhorter
@paulmcwhorter 3 года назад
Sort of cool, isnt it?
@hungry8560
@hungry8560 3 года назад
@@paulmcwhorter it is! I like art so I spent a lot of time trying to find the colors that I want. Its fun to see how RGB works differently than your basic red blue yellow in life.
@markharrisllb
@markharrisllb 3 года назад
Thank you for the 'u', like everything else in your lessons it’s very much appreciated. I think I'll solder my first board and keep this one.
@preetamsingh147
@preetamsingh147 3 года назад
I literally loved playing with analogRead commands in RGB. That was freakishly interesting. Thank you Grand Pa!
@crewchief2761
@crewchief2761 3 года назад
Some times want to scroll up and fix things. Great lessons.
@jaythompson5102
@jaythompson5102 2 года назад
Ok Paul I'm 20 videos deep you are a fantastic teacher! When you say in the other video 'I feel like I'm talking to a brick wall.' I yelled back at my monitor 'I'm here and I'm loving it Paul!'. OK I'm a little bit strange sometimes, I've been home due to COVID for a week and I'm starting to go crazy, yelling at youtube videos. All the same I just wanted to say how enjoyable this has been thus far and I can't wait to be with you to the end! I'll be on your Raspberry Pi videos next I suspect.
@ellerycadel
@ellerycadel 2 года назад
Good lesson. I messed up the brackets after the "if" statements which made a mess of the LEDs lighting up but once I figured that out it worked like a charm. Thanks for a great lesson.
@lordmesha
@lordmesha 4 года назад
i had a common cathode but ive figured it out by looking at circuit diagrams online. used what i learned here to make it work!
@VivekYadav-ds8oz
@VivekYadav-ds8oz 4 года назад
Quick Tip: If you get tired of switching off all the other LEDs in every if statement, just switch of all the LEDs off at the end or at the beginning, and put a _delay_ statement before doing this so that people may get a chance to view the LED state before!
@ryanm5291
@ryanm5291 2 года назад
Great tip. Thanks. Always something to learn just in the comments!
@dipanjanghosal1662
@dipanjanghosal1662 Год назад
That's a great tip. Thanks man.
@tengoose6861
@tengoose6861 Год назад
Thanks so much. I was tearing my hair out.
@steffig7282
@steffig7282 2 года назад
You are a great teacher Mr McWhorter.
@worldtraveler6719
@worldtraveler6719 11 месяцев назад
Love your tutorials.. and love the orange shirt :) Thank you so much
@flipper556
@flipper556 Год назад
Hi Paul! GREAT LESSONS, thank you!!! Here in Canada, we also use colour. Color while gaining popularity is, at this point, American only.
@RavensHammer00
@RavensHammer00 Год назад
I loved being able to play around and get just the color I thought matched the colors asked for, the values suggested online were way off to my eye!. Thanks for the lesson, Paul!
@aynursunagatullin7029
@aynursunagatullin7029 3 года назад
Mr. McWorther, thank you for another amazing lesson, I did the code as well here Is mine int rPin=12; int gPin=8; int bPin=7; String ledColour; int dt=1000; String error="You didn't write an option, please try again."; String msg="What colour led do you want?"; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(rPin,OUTPUT); pinMode(bPin,OUTPUT); pinMode(gPin,OUTPUT); } void loop() { // put your main code here, to run repeatedly: Serial.println(msg); while(Serial.available()==0){ } ledColour=Serial.readString(); if(ledColour=="Blue"||ledColour=="blue"){ digitalWrite(bPin,HIGH); digitalWrite(gPin,LOW); digitalWrite(rPin,LOW); } if(ledColour=="Green"||ledColour=="green"){ digitalWrite(bPin,LOW); digitalWrite(gPin,HIGH); digitalWrite(rPin,LOW); } if(ledColour=="Red"||ledColour=="red"){ digitalWrite(bPin,LOW); digitalWrite(gPin,LOW); digitalWrite(rPin,HIGH); } if(ledColour=="Off"||ledColour=="off"){ digitalWrite(bPin,LOW); digitalWrite(gPin,LOW); digitalWrite(rPin,LOW); } if(ledColour!="Green"&&ledColour!="green"&&ledColour!="Blue"&&ledColour!="blue"&&ledColour!="Red"&&ledColour!="red"&&ledColour!="Off"&&ledColour!="off"){ Serial.println(error); } delay(dt); }
@doverivermedia3937
@doverivermedia3937 2 года назад
So very nice of you to acknowledge us 'Brits". Superb videos ! Insightful and fun. I'm working my way through them all. Fantastic you're digging deeper with important theory. At 58 (and RR aero-engine mechanical engineer), I didn't know a resistor from an LED. Your teaching method is totally engaging. Kudos to you sir. While I'm tapping, and at the risk of being one of those 'wise guys' SOS is souls not ships. 😄. I'm sure i'm not the only smart ass. Greetings from 🇬🇧 ...
@philnewman1110
@philnewman1110 Год назад
Wow! that was a difficult one, really struggled to get the yellow, but it was a great tutorial, thanks Paul.
@CiscoSaeed
@CiscoSaeed 5 лет назад
you gave us the best concept about RGB and how to use it with Arduino..Many thanks to you :-)
@martinhebben2072
@martinhebben2072 4 года назад
Hey Paul. You doing a great job. I'm not always logged in. But i'm doing my "homework". and following you step by step..
@scrappybobbarker5224
@scrappybobbarker5224 3 года назад
The last couple videos about user interaction were a lot of fun, but this program is just too much fun, in addition to your assignment I think I'll have to add a few dozen more colors. Thanks and God bless!
@Yrael55555
@Yrael55555 4 года назад
British learner here, appreciate the UK shout out (Canada and NZ do it too tho!), as well as the course in general
@geekgloryenglish2822
@geekgloryenglish2822 3 года назад
One of the Best courses in RU-vid Ever!
@graemedurden8975
@graemedurden8975 Год назад
Turns out the RGB LED in my kit was a common anode! I got there in the end though. Fun lesson.
@cub1c698
@cub1c698 4 года назад
Hello, fellow Briton. I would just like to say well done to everyone for getting this far in the course and keep up the good work Paul.
@FransSchalkwijk
@FransSchalkwijk 3 года назад
Thanks Paul. Learning a lot. greetings from New Zealand
@paulmcwhorter
@paulmcwhorter 3 года назад
My pleasure!
@paulmccarthy4034
@paulmccarthy4034 3 года назад
Thanks for the shout out (To the brits ) lovin your work !!!
@marksholcomb
@marksholcomb 3 года назад
Enjoyed lessons 19 and 20.
@frankbonsignore.RochesterNY
Wow!! I'm loving this, Paul! Thank you!
@ahopefiend1867
@ahopefiend1867 4 года назад
paused at 2:03 in search of a ping-pong ball...
@richardallen1169
@richardallen1169 3 года назад
Thanks for the shout out Paul. Totally enjoying your very entertaining and colourful course. From Colchester in the UK
@reecevansanden
@reecevansanden Год назад
Really kind of you to give the Brits a nod! We're struggling at the moment with all the division over here - a bit of unity is appreciated.
@georgemaher2310
@georgemaher2310 3 года назад
Luv how interactive you are with the viewers, still I have to turn down the volume for every "BOOOM" haha. Luv from Egypt sir.
@paulmcwhorter
@paulmcwhorter 3 года назад
Wow, it has always been my dream to one day visit Egypt, but have never been able to.
@georgemaher2310
@georgemaher2310 3 года назад
@@paulmcwhorter I hope ur dream comes true one day
@tkingstl
@tkingstl 2 года назад
Great lesson, it puts into perspective the 255 value(s) of color mixing in most programs.
@charlesmarlin6632
@charlesmarlin6632 4 года назад
Added Mauve (RGB 197, 140, 157) Color option because this is such a 'Mauvelous' Arduino Video ... Well Done. Having a lot of fun learning from the Tutorials.
@nerdape7314
@nerdape7314 3 года назад
i still love the way he says "BOOM"
@dougrowell7817
@dougrowell7817 3 года назад
Learning to add your nuggets together. I designed a simple project that dims a blue (oooh special) led using a potentiometer. It then lights a red, yellow or green LED if safe (0-3V), warn (>=3-4V),or red if >4V. If >4V, the system "shuts down", killing the blue LED and lighting the Red. You then need to freduce the voltage and press the reset button to restart. Simple in the real world, but cool for a newbie like me...
@andrewjones4167
@andrewjones4167 3 года назад
Yes got the shout out I'm in England UK. THANK YOU Paul
@kbdozz
@kbdozz 2 года назад
super excited! My Elegoo kit finally arrived - just in the nic of time as I didn't have an RGB LED in my possession....Kit looks great!
@JR-je7ce
@JR-je7ce 3 года назад
Omg thank you so much its been driving me insane watching you spell colour as color after so many episodes it started to feel like I'd been spelling it wrong my whole life haha
@matthewframe92
@matthewframe92 Год назад
I absolutely love your tutorials. I’ve been following you all the way up to lesson 20 (that’s where I’m currently at) I’ve been saving all of the sketches we do and once I finally understand what we’re doing. I go in and tweak it and see if I can’t get it to do what I want it to do. I’m gonna start commenting more. The math is very important too.
@ericsmith7988
@ericsmith7988 4 года назад
This lesson is basically like the last one I just replaced the 3 separate LEDS with the RGB LED. I do not have a small ball like that, I tried using paper and other items but I see where the RGB LED would have uses. Thank you Paul, when I get a ball like that I will come back to this one make different colors.
@stevemorgan3597
@stevemorgan3597 4 года назад
I had a lot of fun creating colours with this one. I used a "while" statement to have the blue and red Led's blink alternatively. Any character sent to serial input turns the blinking off. Thanks for these tutorials.
@eli6156
@eli6156 2 года назад
I have rewritten this program 5 times. Rebuilt this circuit 10 times. Watched the video 25 times. Only to find out about "No line ending" from the comment section. Thanks to the comment section!!!! And Paul
@wendygrant2735
@wendygrant2735 2 года назад
This was a nice one, thank you for the mixing of colours.
@paulmcwhorter
@paulmcwhorter 2 года назад
Glad you liked it!
@erygion
@erygion 4 года назад
I had lots of fun on this one. Thank you Mr. Mcwhorter. Great lesson.
Далее
Сколько стоят роды мечты?
00:59
Просмотров 339 тыс.
Arduino Tutorial 17: Understanding Arduino While Loops
21:05
Arduino Projects - 12 GREAT Ideas for you!!!
9:00
Просмотров 366 тыс.
Analog RGB LED Strip Control with Arduino (Lesson #29)
20:13
Hacking a weird TV censoring device
20:59
Просмотров 3,1 млн