Amazing! You are really ahead of your age group. Keep up the hard work, and make good decisions and you will go far in life. Maybe you will even change the world for the better.
Hi Paul, I am a 57year old male b#British stroke survivor, and am struggling with my condition almost a year after my stroke, for some ago I decided to take a rest from my other hobbey (watercolour painting) mainly because it wasnt taxing my poor old damaged brain enough( I havn' t been able to work due to my condition since my stroke and it has hit me very hard as an engineer to feel a sense of uselessness, which is an honest state of my condition, I hope to return to work one day but at this moment in time it is impossible and I hate , but trying to keep my brain active is most important to me, and over the last few months I have learnt so much from your tuition on you tube, although I can only join in for about 20 minutes at a time, before having to rest or sleep ( part of my condition) I enjoy learning a little bit at a time and am sure that it helps with my hopwfull recovery, thank you for being a good teacher, yours sincerely Mark Snell, Cheltenham, Gos, England UK ,once again many thanks
I was having so much fun with this one I decided to take it a step further and made it so that any input OTHER THAN "red", "green", or "blue" would read "Sorry, please try again...", and cause all three lights to flash in unison, three times. I would recommend this simple addition to anyone looking to expand on this lesson. It took me a couple of tries, and a little debugging because it wasn't specifically talked about in the lesson, but I got it! and I was more excited than I probably should've been. P.S. If you think you are obsessed with tidy boards, I wish I could show you how organized mine are! Everything perfectly space, my wires all have perfect arches, and I always keep my LED's towards the bottom edge of the board so nothing will overlap them. Thanks for these great lessons!
Thank you, bigstickpilot. That solved my issues. The program wouldn't enter the if() statement. Apparently the line return was being interpreted as part of the color. Working now!!
ahhhhhhhhh i had the same problem, ive just spent all morning trying to figure it out, I did read your comment earlier but didnt understand what it meant.
Hi Mr. McWhorter I'm 13 yrs old and want to learn engineering so this series is really helpful to me and the future. Thank you so much for your great teaching. 😁
Here we are at the end of July. When July started I didn't even know what an Arduino was. Now I have an Uno, half a dozen Nanos and a Mega. I have built a sensor 'platform' that has a myriad of sensors and an RTC communicating with clients all talking to each other via NRF24 radio modules, Some clients are for instrumentation others are for data-logging functions. I've used some OLEDs and some 16x2 and 20x4 LCDs. The oleds are nice and the tiny ones are great for mounting below the less-tiny ones to display histograms of the instrument mounted above it. What great fun I'm having and it's all thanks to you taking the time to explain clearly and plainly your knowledge, experience and wisdom. Thanks Mr. McWhorter, you get an A+ from me.
@Dirk Gently Do you exaggerate a little? The beginner's level lessons of Mr McWhorter where sufficient to you in order to be able to make such a huge variety of projects? I don't say that the period of a month is not sufficient to do that. I say that the lessons up to now are at a beginner's level, so it's difficult to help you so much.
Note that there are a lot more arduino lessons on my channel than this new series. In the old series I did some really advanced stuff. Also, I dont think he said my channel was his only resource. Hence, I would completely believe him, and the type of learning he describes is how passionate people pursue a new field.
@@thanoslampropoulos8132 What can I say? I absorb like a sponge. Plus I'm just standing on the shoulders of some genius and talented scientists, engineers, programmers and RUclips teachers that have charted this ground well. Paul has done many more advanced videos and I've watched them all. I watch these new ones because he usually imparts some great bits of knowledge from his vast experience.
@@colepdx187 Now I can understand. By mistake, I thought that you listened only to the new series of videos. It's true that Mr McWhorter has made a wonderful job with his series of videos and has publiced some videos with really advanced stuff. Keep up your great work!
Well, it might be cute the first time, but it gets old pretty quick, considering that had just watched tutorial 18 before this one. I realize that at the time video was posted it had been five days since #18, not 5 minutes, but still.... At 5:54 "I believe that will work", well I don't! At 5:57 "so then what do we want to do?" We want to put a semicolon at the end of that previous line !!! At 7:02 I started breathing really fast, and sure enough you got an error 🤣🤣🤣 Also, you did the same Serial.print when you really wanted Serial.println in the last video too, and... yep, you did the pin mode this last time too, now I understand some things bear repeating, but at tutorial #19 some of the really basic stuff might have already been covered adequately. Or if they are trying to screw with you they might type "bLuE", with the limited choice of the three colors one might just look at the fist letter then one only need to check for 'b','B', 'r','R', 'g','G' that would also work if user shortened their response to R, G or B. the first letter might also work if the answer was given in some other languages Or, since there is a built in function for it, one might also just convert the string to upper (or lower) case then a singe test per color would work Since it is lesson 19, one might have considers switch...case instead of a series of ifs, then in default: one could print a message saying response was not understood
I have the sneaking suspicion that although he does intentionally make mistakes (like using an intiger in the LOOP) he immeidatly corrects himself. When he makes a mistake that wasn't intentional, he plays it off as if he intended to make the mistake so we would call him on it... but that doesn't work on a video... For example, when he was doing the area of a circle code, he mispelled "circle" as "circe" and never caught it no matter how loudly I yelled to point out the mistake. That being said, we are all human and make mistakes, but the intentional ones are getting a little... annoying.
Hello Paul, Even though I am a bit late to the party (the magic of youtube) I would like to thank you for your series. Great production value, high educational standards with code writing and debugging in mind, funny character that helps you stay engaged and be entertained while learning....but the thing I appreciate above all, as a Greek, is the iced cold coffee!! Super excited about this series. Can't wait to complete it so I can move to your Robotics series. Once again, thank you for your work, effort, and passion.
I couldn't figure out why mine wasn't working so I walked away and came back the next day to try with a fresh mind and I still was at a loss untill I came here and found many of you had the same issue and found a solution. Thank you all so much!!!!
I think one of the reasons why your videos are so popular because it shows us that even the best of us have errors and you show the process of correcting it.
I added an if condition so that if you don’t write “red”, “blue”, or “green” then the arduino sends this message back to the serial monitor “I didn’t understand that, try using all lower case letters.” If it wasn’t already way past bedtime I’d add a counter so that after a certain number of tries putting in wrong colours the Arduino would spell out the options for you. Thanks again for this great tutorial series.
I foresaw the problem with strings not matching so I just wrote the question to be, "What color do you want, red, green, or blue? " I didn't really think about the obvious letter case problem. I just know my family well enough to know they would see red, green, and blue LEDs there and select yellow or purple.
Hello Paul! I'm an English teacher from another country with an interest in your field. Lesson 19 now and I'm still sticking by and doing all you do on the go with you. You're one of the best teachers I've ever met and you've not only inspired me on Arduino lessons but also with your teaching methods too. Thank you for all this. I'm a bit late to this but, love your work!
Hello Paul, I am really enjoying your video's, thanks. I am drinking my coffee, just coffee, lots of ice, no sugar or cream, as you have ordered. I am watching all you video's and I am up to 18 tonight. Retiring on October 1 and plan to start my real work. So far I am really enjoying and learning, thanks for all your hard work. Much appreciated. Regards,
Paul, I only found your channel a few days ago. I have been working with Arduino's, but mostly programmed in C++ bij someone else. Your examples are clear, I can't make out when you make a real typo and when you put it in on purpose. My only comment at this stage (lesson 19) is that the breadboard does not have a ground rail for nothing. In example 19 the wiring becomes much clear is you put the short legs of the LED's directly in the ground rail and the only use one ground wire, Another thing: if you want the breadbord and the print to always be parallel, why not fix them to a piece of MDF with a few small screws or double sided tape. Regards, Sierk from the Netherlands
Hi Paul, Just writing from Liverpool in England. First time I've ever bothered subscribing to a RUclips channel. I think the videos (content, format & pace) are excellent, your teaching-style definitely shows your professionalism & teaching/ learning psychology experience. I'm currently working through the 'New' Arduino series & intend to go back to the old series, as well as the IMO and Arduino Python. Then the NVIDIA. I like the repetition, re-capping, focus on a single teaching point, with the relevant links, etc.Only issue is its sometime hard to hold your breath when you laughing!A big 'thank-you' & back to your videos!
I've been in IT since 1974. I have coded and given trainings in several IBM mainframe languages, including S/370 Assembler. Went into Sales in 1983, than into management and been CEO of several companies. It's a real pleasure to get into controlling electronic circuits via Arduino and it's IDE. Paul is a very good teacher, I know the effort that goes into this teaching. Bravo !
Sounds like a similar career path (COBOL, FORTRAN, PL/1,BAL,RPG,GPSS,HASP, RJE, JCL ) and went into sales in 1979, then management and co-founding some startups, etc. Oh the fond memories of BALR 14,15 and not so fond memories of the dreaded abend SB37.
This is how I chose to do the sketch in the lesson. I have found that you need to make user interface as simple and fool proof as possible. I try to provide a menu with single characters for selections, preferably ones which are less likely to have a choice between upper and lower case. //Establish your variables int redPin=9; int greenPin=6; int bluePin=3; int colorPick=0; int (dt)=500; //added a delay time just to make it easier to see errors //We need to control the user inputs, so we give the user as much //information as they need. I chose to have the user enter integers //because they are less likely to mistype them. Strings are best used //for giving instructions. Numbers are better for gathering inputs //where the user must type something. The statements below tell the //user how to enter the data and what range is acceptable. I also //have provided for an out of range response. String msg="Which LED should we light? Type:"; String msg2="1 for Red."; String msg3="2 for Green."; String msg4="3 for Blue."; String msg5="0 for Off."; String msg6="Your choice is out of range. Pick again."; void setup() { Serial.begin(9600); //Turn on the serial monitor pinMode(redPin,OUTPUT); //Setting the pin modes pinMode(greenPin,OUTPUT); pinMode(bluePin,OUTPUT); digitalWrite(redPin,HIGH); //Testing the circuit to be sure delay (dt); //no components have been jarred loose digitalWrite(greenPin,HIGH);//from the board or Arduino delay(dt); digitalWrite(bluePin,HIGH); delay(dt); digitalWrite(redPin,LOW); digitalWrite(greenPin,LOW); digitalWrite(bluePin,LOW); } void loop() { Serial.println(msg); //Ask the user to make a choice of LED Serial.println(msg5); //Explain the options available and Serial.println(msg2); //how to enter the choice, i.e. "1 for blue" Serial.println(msg3); Serial.println(msg4); //Wait for the user to understand the instructions and make a selection while(Serial.available()==0){ } colorPick=Serial.parseInt(); //Set the variable colorPick to their input Serial.println(colorPick); //Print their input (for troubleshooting) //Here we are using if statements to define the action to be taken //for each possible choice made by the user. Note they also have //the option to turn off the previously selected LED without turning //on another LED. if(colorPick==0){ digitalWrite(redPin,LOW); digitalWrite(greenPin,LOW); digitalWrite(bluePin,LOW); } if(colorPick==1){ digitalWrite(redPin,HIGH); digitalWrite(greenPin,LOW); digitalWrite(bluePin,LOW); } if(colorPick==2){ digitalWrite(greenPin,HIGH); digitalWrite(redPin,LOW); digitalWrite(bluePin,LOW); } if(colorPick==3){ digitalWrite(bluePin,HIGH); digitalWrite(redPin,LOW); digitalWrite(greenPin,LOW); } //Here we are taking into account that some users may have issues //with authority or just can't seem to hit the correct key. //If their entry does not correspond to an allowable option //they will be advised in the serial monitor that they have made //a mistake and all LED's will flash on for half a second. if(colorPick3){ Serial.println(msg6); digitalWrite(redPin,HIGH); digitalWrite(greenPin,HIGH); digitalWrite(bluePin,HIGH); delay(dt); digitalWrite(redPin,LOW); digitalWrite(greenPin,LOW); digitalWrite(bluePin,LOW); delay(dt); } }
Your observation makes a lot of sense, so I tried to keep the interface simple, but using strings. That's what my code looks like. int redLEDpin=D7; int greenLEDpin=D6; int blueLEDpin=D5; String colorLED; String msg1= "Which color LED do you want? Type 'red', 'green' or 'blue'."; String msg2= "You picked '"; String msg3= "'. "; String msg4= "Now look at the LED on the breadboard."; String msg5= "Unfortunately, that is not a valid color."; void setup(){ Serial.begin(9600); pinMode(redLEDpin,OUTPUT); pinMode(greenLEDpin,OUTPUT); pinMode(blueLEDpin,OUTPUT); } void loop() { Serial.println(msg1); while(Serial.available()==0){ } colorLED=Serial.readString(); colorLED.toUpperCase(); Serial.print(msg2); Serial.print(colorLED); Serial.print(msg3); Serial.println(msg4); if(colorLED== "RED") { digitalWrite(redLEDpin,HIGH); digitalWrite(greenLEDpin,LOW); digitalWrite(blueLEDpin,LOW); Serial.println(); } if(colorLED=="GREEN") { digitalWrite(redLEDpin,LOW); digitalWrite(greenLEDpin,HIGH); digitalWrite(blueLEDpin,LOW); Serial.println(); } if(colorLED=="BLUE") { digitalWrite(redLEDpin,LOW); digitalWrite(greenLEDpin,LOW); digitalWrite(blueLEDpin,HIGH); Serial.println(); } if(colorLED!="RED" && colorLED!="GREEN" && colorLED!="BLUE") { digitalWrite(redLEDpin,LOW); digitalWrite(greenLEDpin,LOW); digitalWrite(blueLEDpin,LOW); Serial.println(msg5); Serial.println(); } }
Loved this one, and it's finally starting to stick in my mind. I performed the coding slightly different to the way you did it and incorporated the previous example shown: String myInput; String msg="What is your Name? "; String msg2="Hello "; String msg3=", which LED would you like to illuminate?"; int rPin=8; int yPin=9; int bPin=10; int delayT=2500; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(rPin,OUTPUT); pinMode(yPin,OUTPUT); pinMode(bPin,OUTPUT); } void loop() { // put your main code here, to run repeatedly: Serial.println(msg); while (Serial.available()==0){
} myInput=Serial.readString(); Serial.print(msg2); Serial.print(myInput); Serial.println(msg3); while (Serial.available()==0){
Hello Sir!, I watched your video and it was very good! And FYI It was not me, I always hold my breath:) Though after we did the project I decided to take it up a notch. If anyone wants to use this code feel free to do so just hook up the red led to pin 8, green led to pin 11, and blue led to pin 12, as that's what I used while making this program. Here it is: int red = 8; int green = 11; int blue = 12; String msg = "What color LED do you want to light up?"; String msg2 = "How many seconds do you want the LED to light up?"; String msg3 = "How many times you you want to blink the LED?"; int ledTime; int blinkCount; int j; float rdt; float seconds; int rlt; float delayTime; float delayTime2; String myColor; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode (red, OUTPUT); pinMode (green, OUTPUT); pinMode (blue, OUTPUT); } void loop() { // put your main code here, to run repeatedly: Serial.println(msg); while(Serial.available()==0){
} myColor = Serial.readString(); if (myColor == "red"){ Serial.println("RED");
Great lesson again thanks Paul. I practice by having a crack at it purely from memory (fail). Then I go back to previous lessons and check the syntax of the IF statement (still fail!). Then I check your solution and work my way through it with you - SUCCESS! Initially I missed the '=='. Then I had placed the 'Serial.readString' BEFORE each if statement (fail!). I amended (complicated!) my procedure a little by combining two different read statements: 1. asked what is your name? 2. used that string in another sentence and asked 'name' to choose which LED they wanted ON. 3. Turned that LED on, then gave them a confirmation message with the LED they had chosen in the final msg. 4. wrote a delay then turned ALL LED's OFF. Love your work thanks!
Did some head scratching for a few minutes. I am learning so much and just want to thank you. Some people have ability to code and etc. however they cannot teach. I love the way that you simplify things for all to understand. Thank you Paul
Paul, Another great lesson! I was barking at my screen during lesson 18 and 19 because you didn't do a pinMode! I wasn't expecting the LED to come on. Was very surprised when came on and was dim.
Thank you very much for these tutorials, I've been following along and found you to be an excellent teacher. Please keep these excellent tutorials coming
I like that we stick to the basic code for these examples so we fully comprehend what is being taught. Using extra functions that convert to lower case etc is best left for later just like you are doing to avoid confusion. Thanks
Thanks Paul! Really enjoying your series of tutorials. One question though: I'm just wondering why you are not setting up your wiring using the same column for resistor and LED, then using a common (-) to plug all the LED's into. I've found it much easier to just jump the resistor across the trench and plug the LED into the numbered column and the common (-) row.
Hello Paul, Your channel is the first one that I have subscribed to, I am an Electrician from London, England with a bias toward control Engineering. When I watched your first video on the Arduino I thought that you was taking a while to explain things, but going through the different episodes your in depth explanations are the right way to teach. Thank You for sharing your knowledge Stuart Hill London, England
I paused the video and did the circuit work without a hitch, did the pinMode setups but had a hard time trying to figure out how to get just ONE LED to come on at a time. I finally gave up and followed your program. Such an awesome class! This one was very cool! And just think...they are just going to get cooler as we go along!
Hi everyone! Thanks Paul for teaching an old dog some new tricks!!! Until this one I was doing very well but this time it took several hours for me to figure out the serial monitor setting had to be changed to 'no line ending' before it would work. I was so sure it was my coding. Thank goodness a poster mentioned it here. Thanks and keep doing what you do!!! God bless!! :D
Hi Paul I'm usually shy about comments/Internet but I was passing through comments anyway, in search of the "No Line Ending" fix for the Serial Monitor. I had finished this lesson and lesson 20 (in case I simply coded improperly during 19). Thankfully, I found the fix quickly. So here I am after 20 lessons and I'm compelled to leave you this message: you are fantastic. You are a part of my daily life to the extent I will say things to my wife, like "gotta get back to Mr. McWhorter's class." You seem interested in who/what your viewers are/doing - and I'll keep this short - so here are just a few bullet points. I'm 51. Married. Started all this to generate interest for teenage child. I immediately assumed you were a teacher. I'm actually married to a teacher. More interestingly: after lessons and while paused I usually tweak the code to include more and different things, as I have wrapped my head around them, due to your "class." Sometimes I feel like I am the "teacher's pet" and other times I feel like I am the class smart-guy. Most importantly I believe my "feels" are a testament to how wonderful and personal your videos are. Please keep going. I'll be watching and learning. Thank you for the incredible gift that is The Arduino Tutorials. PS is that really coffee in your mug? Just kidding. When I'm not learning to code, I'm all about the coffee here at home. From pumping Espresso to French Press to Cold Brew and everything in between. I'm fortunate in that I live close to a local roaster with beans from around the world and sometimes I wonder if you've had any first-hand interactions with beans/farmers. Anyway, thank you, again!
I used the toUpperCase() function and then just tested the string against it's uppercase value in the if statement. Also set a flag if the colour choice was a valid entry and tested it at the end of the code which displayed an error message if red, green or blue had not been entered and of course reset it after the error message. I found this tutorial very useful as a step in the right direction to controlling actions through the Arduino IDE. Thanks for your efforts Paul.
Didn`t read the part about setting the serialMonitor to "No line ending". Was going absolutely nuts trying to figure out what was wrong,lol. Rewrote the whole thing a few times until i finally saw the comments. My board almost went flying out the window here hahaha. Another great video Mr.Worther. thank you for your dedication :)
This is a Great tutorial on using Arduino for a beginner like my self. Only one thing I miss in your tutorial was on COM PORT setting. Got the port setup on the right USB, and the right Baud Rate of 9600 , but I did find out that the line feed has to be in "no line ending" to work correctly. That little set back made me go thru my program looking for my error in code . Looking for all the info i could find on WHILE statement thinking i had something wrong. It was my son that saw my mistake and showed me how to fix it. SO FOR YOU BEGINNER MAKE SURE YOU ARE ON "no line ending" IN YOUR COM PORT,
I had the hardest time getting this to work...i started and stopped the video more times than I can remember...I changed the values to match his exactly. I started looking into the comments and found this. I changed that setting and it worked immediately. THANK YOU for posting this. I was going absolutely nuts trying to get this working.
Thanks a lot for that great lesson! I really liked your assigment and did it a little bit different, for example I set all 3 LEDs to LOW right after the wait loop and than only set the on LED to high that the user submitted. I also made an error message if the user submitted anything else than red, green or blue in lowercase. For those who are interested, here is my code: int rLED = 12; int gLED = 10; int bLED = 8; int dt = 200; String onLED; String msg = "What color do you like? You can choose from red, green and blue."; String msg2 = "The "; String msg3 = ", LED is now powered on!"; String msg4 = "Error! You can only choose from red, green and blue. Keep in mind that your input is case sensitive!"; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(rLED, OUTPUT); pinMode(gLED, OUTPUT); pinMode(bLED, OUTPUT); } void loop() { // put your main code here, to run repeatedly: Serial.println(msg); while (Serial.available() == 0) { } digitalWrite(rLED, LOW); digitalWrite(gLED, LOW); digitalWrite(bLED, LOW); onLED = Serial.readString(); if (onLED == "red") { digitalWrite(rLED, HIGH); Serial.print(msg2); Serial.print(onLED); Serial.println(msg3); } else if (onLED == "green") { digitalWrite(gLED, HIGH); Serial.print(msg2); Serial.print(onLED); Serial.println(msg3); } else if (onLED == "blue") { digitalWrite(bLED, HIGH); Serial.print(msg2); Serial.print(onLED); Serial.println(msg3); } else { Serial.println(msg4); digitalWrite(rLED, HIGH); digitalWrite(gLED, HIGH); digitalWrite(bLED, HIGH); delay(dt); digitalWrite(rLED, LOW); digitalWrite(gLED, LOW); digitalWrite(bLED, LOW); delay(dt); digitalWrite(rLED, HIGH); digitalWrite(gLED, HIGH); digitalWrite(bLED, HIGH); delay(dt); digitalWrite(rLED, LOW); digitalWrite(gLED, LOW); digitalWrite(bLED, LOW); } }
I struggled for hours to get mine to work . Then I read the comment make sure you have 'no line ending' in the serial monitor box. Then BOOM it worked. Thanks InvisibleHero. Thanks too Paul. great Series.
I was stuck on this for a while. I even had to take a break from this lesson. It really helps that you dont put ";" after the if condition.Thank goodness I found this. Thanks for the lessons!
Very nice tutorials Paul. Have been following this tutorial for a few days now and will be following till the end. A year after this was uploaded and still I find this very helpful. Thank you so much for your time and effort! Love them all. We need more people like you. Thanks a lot once agian!
Another instructive tutorial Paul, keep up the great work. As mentioned earlier I'"chucked in the towel" at my last attempt, but I think I may be past the "towel chucking" stage now All down to you mate!!!
The IF statement kept changing the "myColor" after about a half an hour I remembered to put == and not=. It was quite challenging. It worked perfect after the correction. Thank you Paul.
I'm glad you explained how the breadboard works. I use one ground just by connecting the negative rail. That way I use one ground on the Arduino and hook all the LEDs to the negative rail.
So fun to play along. Thanks again for another great lesson! I added some other responses like "You picked GREEN!" as well as a delay for how long the light stayed on. After the light turns off another message that says "You did it! Thanks for playing." I wanted to add further instructions if the CAPS were incorrect and got close but was unable to make it work correctly. I'm sure we will cover this in the future. Good luck everyone!
Mine says, "You selected: " and then myColor. I was troubleshooting the problem that was corrected with the selection for No line ending. Still, my adding the extra 2 lines of code told me my problem was not with the while line.
Hello, Paul! For the 3 LEDs light up, I initial used 3 "while" loops instead of 3 "if" loops. It ended my program would not loop back. It only asked the question once and then lighted the LED up accordingly, and no more actions afterwards. After watching your solution, I changed all three "while" words to "if" words. It looped back ☺. Now I think I gained better understanding the differences between "if" and "while". Thank you!
When I did the assignment, I added an if statement that on any misspelling or capitalization an error message would be generated asking the user to try again. I'm 73 and learning Arduino coding through your videos. Many thanks.
This one I couldn't get working on the first try. My reasoning was correct, but I made two mistakes in the code. The first mistake was not using == inside the If statement. I ended up googling about If statements as a refresher and there I saw the error. The second mistake was that I did think about including the capitalized version of the color, but I wrote it < if(color=="red" || "Red") > and it did not work like this. This I couldn't figure out until I saw the rest of the video. All in all, a super fun lesson.
The trademark "BOOOM" always liven up the lessons. No one will unsubscribe you. I will stay with the lessons, all of them. I now carry a small box and cable around and practice the lessons in fast food places, using my mobile phone version of IDE. Many thanks Paul Sir.
Thank you, I'm slowly seeing how we can use these in different setups. For example I could turn "blue" to "Lamp" and just plug in a lamp to the setup. It's great seeing this little board come to life.
This has been a great way to unify all the stuff we've been learning up till now. When I originally started trying to solve this, I wanted to turn myColor into an int, and then have the user select a number instead of typing in a word because I was worried about what would happen if they didn't type in the word exactly as expected. I'm definitely finding a great deal of value in this tutorial series, and can't wait to find out how to create an exception for when people don't use the exact command properly.
This was a fun challenge! I loved figuring out myself how to send a message if the input command was in the wrong format, and adding a secret command to turn on all three LEDs. Love the series!
I really appreciate your teaching. I was not getting the desired output until I checked the comments and the video caption. I appreciate the way you try to solve our doubts . We are blessed to have a great teacher like you! Thank you!😄
I set my LED's up so that the GND legs are all in the outside bus. That way only one GND wire is needed. Makes it a lot easier and neater. Thanks for the BRILLIANT tutorial.
I've noticed this 19 lessons in. I've been following your instructions almost exactly. The main difference is that I use my own variable names. The thing I noticed is that it makes me think a little more and sort of forces me to troubleshoot on my own without just looking at your code and copying it exactly. I tried looking back and forth and thinking "Okay, so I used this name instead of the name he used, so I should find every time he wrote his and match it up with mine and make sure it follows." That was difficult going back and forth and back and forth like that. Having my own variable names forced me to think for myself and try to find out where I went wrong with something. I think that'd be a great thing to suggest in your videos so people can try to think on their own.
I added another interactive input asking for the number of blinks you want (for the selected LED color). You can copy and paste Paul's if statements, and put them in a for loop. Very fun. Thanks Paul!
Additionally, as a former events technician who has trained up and coming techs, I think your attitude to mistakes is fantastic. Making mistakes happens most days, and it's so important to just be comfortable to go 'whoops, that was my fault.'
I couln't make the exercise asked at begining. But during the lecture I came to a point where I was able to complete well the program by adding ; "Your Led Color is" then "red,green, or blue"; add also a 3 second delay to put led LOW at the end of cycle. Stuff is getting to comprehension to me. Thank you Paul.
Paul, really enjoy when you give us projects to try on our own. They help me test my retention of the tutorial and gives me a chance to think about what I've learned. Very beneficial!
I did the assignment a little differently, in my program instead of just turning LEDs on, it blinked the LEDs 5 times, I used a for statement inside each if statement for blink the LEDs. And yes, I did not forget to use variables. Great videos keep up the good work sir.
I completed the lesson with flying colors! I love this. I made it so you can turn the LEDs on and off, they can be on at all different times, and i can turn them all off/on at one time! 🥰
Spent more than one hour troubleshooting for this lesson. If I didn’t read the description in this video I would have spent another one hour. “No line ending.” Please set your serial monitor guysss. After that you can hold your breath and say ,”BOOOM it works!”
Wow, I got it. This was a tough assignment. I took a break to work on other projects, so I had to go back to lesson 12 to remind me how the "if" statement needed to be laid out.
Thank you Sir, I am a 13 year old Student from Punjab (India) and love watching your videos as they teach a lot about Arduino boards as I always wanted to learn to use them.
Omg. Just as i was experiencing it, (my LED was so dim i thought I got the connections wrong) that sir Paul got his dim too! So i was so happy he mentioned the pinMode that i also forgot.
I have a pretty good foundation for programming from years of messing around with game engines like Unity and Godot but it's nice to have someone teach so thoroughly the concepts needed to apply that to physical hardware like an Arduino. Love your teaching style - very easy to follow and understand in relatively short lessons. This dad in his 30's appreciates your time and energy creating this series!
I have added in my programming clauses to turn off the LEDs and an Error msg if wrong colors or text is inputted by the user. I am new to programming and arduino's. These courses are very interesting. I have followed them since course 1 and will continue on. Thank you Mr. McWorther.
Paul, I have not seen all of your videos and maybe you have figured this out between the time of posting and now, but if you need to change one word, such as HIGH to LOW, you can double click on that word to highlight it. Makes the copy paste go a bit faster. You can then copy LOW and quickly paste it everywhere the change is needed...etc. Thanks again for your lessons!!!!!
This was driving me crazy. It seemed like none of my digitalWrites were working. Checked the circuits and with 5v to each resistor and the LED worked! But the digital output wasn't there. Tried everything I could think of, but nothing worked Then, I saw the "No line ending" phrase appearing in the comments. Changed that and "BOOM," it works! Was this in a lesson and I missed it? Oh, well. I'm enjoying this course tremendously. One thing I've learned is to minimize wires by using the rail busses. I find that more convenient, personally. Keep up the good work, Paul. I'm on lesson 24 and having a ball. I teach power plant operations and plant simulator training which includes a lot of electrical theory and digital controls. I appreciate your teaching style and your expertise. Also, plan to make some videos, using the Arduino, to help teach basic electricity and controls. Again, great job. Looking forward to future lessons.
If I had teacher like you in my school days, I 'might' have become an engineer! I am amazed at the clarity of your teaching, humanity and most of all your generosity. I am following your Arduino lessons, now at lesson 19. I can not say that I can repeat what I learned yet, but I will get there. I have an idea about aviation security programming that I would like to run by you, it has the potential to save numerous lives. Please contact me.
I'm 62 and just learning the Arduino. Your tutorials are the best. You explain things very well. Your teaching style is second to none and even when you make mistakes to test me it really helps me to work out the issues. I watch every lesson and faithfully do the assignments and the work along with you. Can't wait until I finish this set and move on to another one of your tutorials - most likely Python. Additionally, there's a teen in my town that wants to be an Engineer and I've given him the link to your channel. FYI I'm in Australia so my purchases go through the Aus store. Any other way to support your excellent work?? Cheers from down under :-)
I’ve been following along to these videos using an Arduino Mega 2560 kit from Elegoo. These are the best lessons to learn Arduino. I just can’t drink iced coffee. It has to be hot.
Thx for another great lesson and assignment Paul. Here is how i did it, i used if, else if and else instead. int redLED = 10; int greenLED = 11; int blueLED = 12; //LED 13 operates together with internal LED and shows strange behavior String msg = "What color LED would you like me to turn on? "; String msg2 = "Options are 'red', 'green, blue or all: "; String msg3 = " is turned on !!!"; String msg4 = "Not a valid color"; String ledColor; String red = "red"; String green = "green"; String blue = "blue"; String all = "all"; void setup() { // put your setup code here, to run once: pinMode(redLED, OUTPUT); pinMode(greenLED, OUTPUT); pinMode(blueLED, OUTPUT); Serial.begin(9600); } void loop() { // put your main code here, to run repeatedly: Serial.println(msg); Serial.println(msg2); while (Serial.available() == 0) { } ledColor = Serial.readString(); if (ledColor == red) { digitalWrite(redLED, HIGH); digitalWrite(greenLED, LOW); digitalWrite(blueLED, LOW); Serial.println(ledColor + msg3); } else if (ledColor == green) { // if would also work !!! digitalWrite(redLED, LOW); digitalWrite(greenLED, HIGH); digitalWrite(blueLED, LOW); Serial.println(ledColor + msg3); } else if (ledColor == blue) { // if would also work !!! digitalWrite(redLED, LOW); digitalWrite(greenLED, LOW); digitalWrite(blueLED, HIGH); Serial.println(ledColor + msg3); } else if (ledColor == all) { // if would also work !!! digitalWrite(redLED, HIGH); digitalWrite(greenLED, HIGH); digitalWrite(blueLED, HIGH); Serial.println(ledColor + msg3); } else { Serial.println(msg4); } }
The assignment was a good brain teaser, thank you! Turns out the mistake I made was not putting quotations around my color variables inside my if statements, leading to blue being constantly lit no matter what color I typed. I also added a message after entering a color that said "Activating (color) LED now!" on a new line :)
I’m 12 years old and starting to get into engineering and your tutorials have helped me a lot, thank you!
Amazing! You are really ahead of your age group. Keep up the hard work, and make good decisions and you will go far in life. Maybe you will even change the world for the better.
We gotta protect Paul.
He is too Precious.
Love you Paul!!
I learned a hard lesson on "no line ending" Its one i will not forget! Amazing lessons!!
That was my problem too.... thanks for the heads up that solved my problem
I did too! Couldn't figure out why it wouldn't work.
this one got me too
Thank alot for this had me stuck for hours😣
I need felp no line ending where?
You have changed me from “I’m fascinated, but I don’t understand arduino” to “I get it, it works” in 2 days. Thank you, sir.
These are the best Arduino tutorials on the entire internet. I love your style of teaching especially your intentional mistakes. Thank you so much!
yes exactly , the intentional mistakes make sure that we learn well. Thanks sir!
Hi Paul, I am a 57year old male b#British stroke survivor, and am struggling with my condition almost a year after my stroke, for some ago I decided to take a rest from my other hobbey (watercolour painting) mainly because it wasnt taxing my poor old damaged brain enough( I havn' t been able to work due to my condition since my stroke and it has hit me very hard as an engineer to feel a sense of uselessness, which is an honest state of my condition, I hope to return to work one day but at this moment in time it is impossible and I hate , but trying to keep my brain active is most important to me, and over the last few months I have learnt so much from your tuition on you tube, although I can only join in for about 20 minutes at a time, before having to rest or sleep ( part of my condition) I enjoy learning a little bit at a time and am sure that it helps with my hopwfull recovery, thank you for being a good teacher, yours sincerely Mark Snell, Cheltenham, Gos, England UK ,once again many thanks
I was having so much fun with this one I decided to take it a step further and made it so that any input OTHER THAN "red", "green", or "blue" would read "Sorry, please try again...", and cause all three lights to flash in unison, three times. I would recommend this simple addition to anyone looking to expand on this lesson. It took me a couple of tries, and a little debugging because it wasn't specifically talked about in the lesson, but I got it! and I was more excited than I probably should've been. P.S. If you think you are obsessed with tidy boards, I wish I could show you how organized mine are! Everything perfectly space, my wires all have perfect arches, and I always keep my LED's towards the bottom edge of the board so nothing will overlap them. Thanks for these great lessons!
I discovered that the serial monitor window has to be set to "no line ending" or I get uncommanded line returns
same problem, took me two days
わたしも。。。
Thank you, bigstickpilot. That solved my issues. The program wouldn't enter the if() statement. Apparently the line return was being interpreted as part of the color. Working now!!
ahhhhhhhhh i had the same problem, ive just spent all morning trying to figure it out, I did read your comment earlier but didnt understand what it meant.
I was having that problem too! Thank you for sharing! I was really annoyed at that.
Hi Mr. McWhorter I'm 13 yrs old and want to learn engineering so this series is really helpful to me and the future. Thank you so much for your great teaching. 😁
same im 12 this dude is really helpful to learn arduino
Here we are at the end of July. When July started I didn't even know what an Arduino was. Now I have an Uno, half a dozen Nanos and a Mega. I have built a sensor 'platform' that has a myriad of sensors and an RTC communicating with clients all talking to each other via NRF24 radio modules, Some clients are for instrumentation others are for data-logging functions. I've used some OLEDs and some 16x2 and 20x4 LCDs. The oleds are nice and the tiny ones are great for mounting below the less-tiny ones to display histograms of the instrument mounted above it. What great fun I'm having and it's all thanks to you taking the time to explain clearly and plainly your knowledge, experience and wisdom.
Thanks Mr. McWhorter, you get an A+ from me.
Sounds like a productive month!
@Dirk Gently Do you exaggerate a little? The beginner's level lessons of Mr McWhorter where sufficient to you in order to be able to make such a huge variety of projects? I don't say that the period of a month is not sufficient to do that. I say that the lessons up to now are at a beginner's level, so it's difficult to help you so much.
Note that there are a lot more arduino lessons on my channel than this new series. In the old series I did some really advanced stuff. Also, I dont think he said my channel was his only resource. Hence, I would completely believe him, and the type of learning he describes is how passionate people pursue a new field.
@@thanoslampropoulos8132 What can I say? I absorb like a sponge. Plus I'm just standing on the shoulders of some genius and talented scientists, engineers, programmers and RUclips teachers that have charted this ground well. Paul has done many more advanced videos and I've watched them all. I watch these new ones because he usually imparts some great bits of knowledge from his vast experience.
@@colepdx187 Now I can understand. By mistake, I thought that you listened only to the new series of videos. It's true that Mr McWhorter has made a wonderful job with his series of videos and has publiced some videos with really advanced stuff. Keep up your great work!
gotta love Paul's reactions to his intentional mistakes
Well, it might be cute the first time, but it gets old pretty quick, considering that had just watched tutorial 18 before this one. I realize that at the time video was posted it had been five days since #18, not 5 minutes, but still....
At 5:54 "I believe that will work", well I don't!
At 5:57 "so then what do we want to do?" We want to put a semicolon at the end of that previous line !!!
At 7:02 I started breathing really fast, and sure enough you got an error 🤣🤣🤣
Also, you did the same Serial.print when you really wanted Serial.println in the last video too, and... yep, you did the pin mode this last time too, now I understand some things bear repeating, but at tutorial #19 some of the really basic stuff might have already been covered adequately.
Or if they are trying to screw with you they might type "bLuE", with the limited choice of the three colors one might just look at the fist letter then one only need to check for 'b','B', 'r','R', 'g','G' that would also work if user shortened their response to R, G or B. the first letter might also work if the answer was given in some other languages
Or, since there is a built in function for it, one might also just convert the string to upper (or lower) case then a singe test per color would work
Since it is lesson 19, one might have considers switch...case instead of a series of ifs, then in default: one could print a message saying response was not understood
@@jaytalbot1146 i agree :)
@@jaytalbot1146 Even though I agree, I feel like for a total newbie who has ZERO experience coding, those repeated errors are very helpful.
"intentional" right ;) Like Inspector Clouseau: "I was just testing you"
I have the sneaking suspicion that although he does intentionally make mistakes (like using an intiger in the LOOP) he immeidatly corrects himself. When he makes a mistake that wasn't intentional, he plays it off as if he intended to make the mistake so we would call him on it... but that doesn't work on a video...
For example, when he was doing the area of a circle code, he mispelled "circle" as "circe" and never caught it no matter how loudly I yelled to point out the mistake.
That being said, we are all human and make mistakes, but the intentional ones are getting a little... annoying.
Hello Paul,
Even though I am a bit late to the party (the magic of youtube) I would like to thank you for your series.
Great production value, high educational standards with code writing and debugging in mind, funny character that helps you stay engaged and be entertained while learning....but the thing I appreciate above all, as a Greek, is the iced cold coffee!!
Super excited about this series. Can't wait to complete it so I can move to your Robotics series.
Once again, thank you for your work, effort, and passion.
I couldn't figure out why mine wasn't working so I walked away and came back the next day to try with a fresh mind and I still was at a loss untill I came here and found many of you had the same issue and found a solution. Thank you all so much!!!!
What’s the solution?
I think one of the reasons why your videos are so popular because it shows us that even the best of us have errors and you show the process of correcting it.
I added an if condition so that if you don’t write “red”, “blue”, or “green” then the arduino sends this message back to the serial monitor “I didn’t understand that, try using all lower case letters.” If it wasn’t already way past bedtime I’d add a counter so that after a certain number of tries putting in wrong colours the Arduino would spell out the options for you.
Thanks again for this great tutorial series.
I foresaw the problem with strings not matching so I just wrote the question to be, "What color do you want, red, green, or blue? " I didn't really think about the obvious letter case problem. I just know my family well enough to know they would see red, green, and blue LEDs there and select yellow or purple.
Hello Paul! I'm an English teacher from another country with an interest in your field. Lesson 19 now and I'm still sticking by and doing all you do on the go with you. You're one of the best teachers I've ever met and you've not only inspired me on Arduino lessons but also with your teaching methods too. Thank you for all this. I'm a bit late to this but, love your work!
Fantastic!
These tutorials are fantastic and make me WANT to learn more!
I stopped the video, did the work alone and it worked. That was exciting. You're the best Master Paul
Hello Paul, I am really enjoying your video's, thanks. I am drinking my coffee, just coffee, lots of ice, no sugar or cream, as you have ordered. I am watching all you video's and I am up to 18 tonight. Retiring on October 1 and plan to start my real work. So far I am really enjoying and learning, thanks for all your hard work. Much appreciated.
Regards,
Paul,
I only found your channel a few days ago. I have been working with Arduino's, but mostly programmed in C++ bij someone else. Your examples are clear, I can't make out when you make a real typo and when you put it in on purpose.
My only comment at this stage (lesson 19) is that the breadboard does not have a ground rail for nothing. In example 19 the wiring becomes much clear is you put the short legs of the LED's directly in the ground rail and the only use one ground wire,
Another thing: if you want the breadbord and the print to always be parallel, why not fix them to a piece of MDF with a few small screws or double sided tape.
Regards, Sierk from the Netherlands
Hi Paul,
Just writing from Liverpool in England.
First time I've ever bothered subscribing to a RUclips channel. I think the videos (content, format & pace) are excellent, your teaching-style definitely shows your professionalism & teaching/ learning psychology experience. I'm currently working through the 'New' Arduino series & intend to go back to the old series, as well as the IMO and Arduino Python. Then the NVIDIA. I like the repetition, re-capping, focus on a single teaching point, with the relevant links, etc.Only issue is its sometime hard to hold your breath when you laughing!A big 'thank-you' & back to your videos!
I've been in IT since 1974. I have coded and given trainings in several IBM mainframe languages, including S/370 Assembler. Went into Sales in 1983, than into management and been CEO of several companies. It's a real pleasure to get into controlling electronic circuits via Arduino and it's IDE. Paul is a very good teacher, I know the effort that goes into this teaching. Bravo !
Sounds like a similar career path (COBOL, FORTRAN, PL/1,BAL,RPG,GPSS,HASP, RJE, JCL ) and went into sales in 1979, then management and co-founding some startups, etc. Oh the fond memories of BALR 14,15 and not so fond memories of the dreaded abend SB37.
I seriously feel guilty for not holding my breath everytime his code bugs.
So you're to blame.
You monster
🤣
We found the culprit!
Damnit Girish, get your shit together or we're gonna have PROBLEMS. I don't want you wasting any more of MY TIME.
Seriously better than any costly course , just free knowledge
This is how I chose to do the sketch in the lesson. I have found that you need to make user interface as simple and fool proof as possible. I try to provide a menu with single characters for selections, preferably ones which are less likely to have a choice between upper and lower case.
//Establish your variables
int redPin=9;
int greenPin=6;
int bluePin=3;
int colorPick=0;
int (dt)=500; //added a delay time just to make it easier to see errors
//We need to control the user inputs, so we give the user as much
//information as they need. I chose to have the user enter integers
//because they are less likely to mistype them. Strings are best used
//for giving instructions. Numbers are better for gathering inputs
//where the user must type something. The statements below tell the
//user how to enter the data and what range is acceptable. I also
//have provided for an out of range response.
String msg="Which LED should we light? Type:";
String msg2="1 for Red.";
String msg3="2 for Green.";
String msg4="3 for Blue.";
String msg5="0 for Off.";
String msg6="Your choice is out of range. Pick again.";
void setup() {
Serial.begin(9600); //Turn on the serial monitor
pinMode(redPin,OUTPUT); //Setting the pin modes
pinMode(greenPin,OUTPUT);
pinMode(bluePin,OUTPUT);
digitalWrite(redPin,HIGH); //Testing the circuit to be sure
delay (dt); //no components have been jarred loose
digitalWrite(greenPin,HIGH);//from the board or Arduino
delay(dt);
digitalWrite(bluePin,HIGH);
delay(dt);
digitalWrite(redPin,LOW);
digitalWrite(greenPin,LOW);
digitalWrite(bluePin,LOW);
}
void loop() {
Serial.println(msg); //Ask the user to make a choice of LED
Serial.println(msg5); //Explain the options available and
Serial.println(msg2); //how to enter the choice, i.e. "1 for blue"
Serial.println(msg3);
Serial.println(msg4);
//Wait for the user to understand the instructions and make a selection
while(Serial.available()==0){
}
colorPick=Serial.parseInt(); //Set the variable colorPick to their input
Serial.println(colorPick); //Print their input (for troubleshooting)
//Here we are using if statements to define the action to be taken
//for each possible choice made by the user. Note they also have
//the option to turn off the previously selected LED without turning
//on another LED.
if(colorPick==0){
digitalWrite(redPin,LOW);
digitalWrite(greenPin,LOW);
digitalWrite(bluePin,LOW);
}
if(colorPick==1){
digitalWrite(redPin,HIGH);
digitalWrite(greenPin,LOW);
digitalWrite(bluePin,LOW);
}
if(colorPick==2){
digitalWrite(greenPin,HIGH);
digitalWrite(redPin,LOW);
digitalWrite(bluePin,LOW);
}
if(colorPick==3){
digitalWrite(bluePin,HIGH);
digitalWrite(redPin,LOW);
digitalWrite(greenPin,LOW);
}
//Here we are taking into account that some users may have issues
//with authority or just can't seem to hit the correct key.
//If their entry does not correspond to an allowable option
//they will be advised in the serial monitor that they have made
//a mistake and all LED's will flash on for half a second.
if(colorPick3){
Serial.println(msg6);
digitalWrite(redPin,HIGH);
digitalWrite(greenPin,HIGH);
digitalWrite(bluePin,HIGH);
delay(dt);
digitalWrite(redPin,LOW);
digitalWrite(greenPin,LOW);
digitalWrite(bluePin,LOW);
delay(dt);
}
}
The point of this was learning to use strings
Your observation makes a lot of sense, so I tried to keep the interface simple, but using strings. That's what my code looks like.
int redLEDpin=D7;
int greenLEDpin=D6;
int blueLEDpin=D5;
String colorLED;
String msg1= "Which color LED do you want? Type 'red', 'green' or 'blue'.";
String msg2= "You picked '";
String msg3= "'. ";
String msg4= "Now look at the LED on the breadboard.";
String msg5= "Unfortunately, that is not a valid color.";
void setup(){
Serial.begin(9600);
pinMode(redLEDpin,OUTPUT);
pinMode(greenLEDpin,OUTPUT);
pinMode(blueLEDpin,OUTPUT);
}
void loop() {
Serial.println(msg1);
while(Serial.available()==0){
}
colorLED=Serial.readString();
colorLED.toUpperCase();
Serial.print(msg2);
Serial.print(colorLED);
Serial.print(msg3);
Serial.println(msg4);
if(colorLED== "RED") {
digitalWrite(redLEDpin,HIGH);
digitalWrite(greenLEDpin,LOW);
digitalWrite(blueLEDpin,LOW);
Serial.println();
}
if(colorLED=="GREEN") {
digitalWrite(redLEDpin,LOW);
digitalWrite(greenLEDpin,HIGH);
digitalWrite(blueLEDpin,LOW);
Serial.println();
}
if(colorLED=="BLUE") {
digitalWrite(redLEDpin,LOW);
digitalWrite(greenLEDpin,LOW);
digitalWrite(blueLEDpin,HIGH);
Serial.println();
}
if(colorLED!="RED" && colorLED!="GREEN" && colorLED!="BLUE") {
digitalWrite(redLEDpin,LOW);
digitalWrite(greenLEDpin,LOW);
digitalWrite(blueLEDpin,LOW);
Serial.println(msg5);
Serial.println();
}
}
Loved this one, and it's finally starting to stick in my mind. I performed the coding slightly different to the way you did it and incorporated the previous example shown:
String myInput;
String msg="What is your Name? ";
String msg2="Hello ";
String msg3=", which LED would you like to illuminate?";
int rPin=8;
int yPin=9;
int bPin=10;
int delayT=2500;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(rPin,OUTPUT);
pinMode(yPin,OUTPUT);
pinMode(bPin,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println(msg);
while (Serial.available()==0){
}
myInput=Serial.readString();
Serial.print(msg2);
Serial.print(myInput);
Serial.println(msg3);
while (Serial.available()==0){
}
myInput=Serial.readString();
if (myInput=="red" || myInput=="Red" || myInput=="RED"){
digitalWrite(rPin,HIGH);
delay(delayT);
digitalWrite(rPin,LOW);
delay(delayT);
}
if (myInput=="yellow" || myInput=="Yellow" || myInput=="YELLOW"){
digitalWrite(yPin,HIGH);
delay(delayT);
digitalWrite(yPin,LOW);
delay(delayT);
}
if (myInput=="blue" || myInput=="Blue" || myInput=="BLUE"){
digitalWrite(bPin,HIGH);
delay(delayT);
digitalWrite(bPin,LOW);
delay(delayT);
}
if (myInput=="all" || myInput=="All" || myInput=="ALL"){
digitalWrite(rPin,HIGH);
digitalWrite(yPin,HIGH);
digitalWrite(bPin,HIGH);
delay(delayT);
digitalWrite(rPin,LOW);
digitalWrite(yPin,LOW);
digitalWrite(bPin,LOW);
delay(delayT);
}
}
These assignments are so much fun, and it makes me so happy every time I get the output before watching the video! Thank you for these!!
Hello Sir!, I watched your video and it was very good! And FYI It was not me, I always hold my breath:) Though after we did the project I decided to take it up a notch. If anyone wants to use this code feel free to do so just hook up the red led to pin 8, green led to pin 11, and blue led to pin 12, as that's what I used while making this program. Here it is:
int red = 8;
int green = 11;
int blue = 12;
String msg = "What color LED do you want to light up?";
String msg2 = "How many seconds do you want the LED to light up?";
String msg3 = "How many times you you want to blink the LED?";
int ledTime;
int blinkCount;
int j;
float rdt;
float seconds;
int rlt;
float delayTime;
float delayTime2;
String myColor;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode (red, OUTPUT);
pinMode (green, OUTPUT);
pinMode (blue, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println(msg);
while(Serial.available()==0){
}
myColor = Serial.readString();
if (myColor == "red"){
Serial.println("RED");
Serial.println(msg2);
while(Serial.available()==0){
}
seconds = Serial.parseInt();
ledTime = seconds * 1000;
Serial.println(seconds);
Serial.println(msg3);
while(Serial.available()==0){
}
blinkCount = Serial.parseInt();
Serial.println(blinkCount);
delayTime = (ledTime/blinkCount);
delayTime2 = (delayTime/2);
for (j = 0; j < blinkCount; j = j+1){
digitalWrite(blue, LOW);
digitalWrite(green, LOW);
digitalWrite(red, HIGH);
delay(delayTime2);
digitalWrite(red, LOW);
delay(delayTime2);
}
}
if (myColor == "green"){
Serial.println("GREEN");
Serial.println(msg2);
while(Serial.available()==0){
}
seconds = Serial.parseInt();
ledTime = seconds * 1000;
Serial.println(seconds);
Serial.println(msg3);
while(Serial.available()==0){
}
blinkCount = Serial.parseInt();
Serial.println(blinkCount);
delayTime = (ledTime/blinkCount);
delayTime2 = (delayTime/2);
for (j = 0; j < blinkCount; j = j+1){
digitalWrite(blue, LOW);
digitalWrite(red, LOW);
digitalWrite(green, HIGH);
delay(delayTime2);
digitalWrite(green, LOW);
delay(delayTime2);
}
}
if (myColor == "blue"){
Serial.println("BLUE");
Serial.println(msg2);
while(Serial.available()==0){
}
seconds = Serial.parseInt();
ledTime = seconds * 1000;
Serial.println(seconds);
Serial.println(msg3);
while(Serial.available()==0){
}
blinkCount = Serial.parseInt();
Serial.println(blinkCount);
delayTime = (ledTime/blinkCount);
delayTime2 = (delayTime/2);
for (j = 0; j < blinkCount; j = j+1){
digitalWrite(green, LOW);
digitalWrite(red, LOW);
digitalWrite(blue, HIGH);
delay(delayTime2);
digitalWrite(blue, LOW);
delay(delayTime2);
}
}
if (myColor == "stop"){
digitalWrite(red, LOW);
digitalWrite(green, LOW);
digitalWrite(blue, LOW);
}
}
Just for fun, added another variable “all” to turn all LED’s on. It worked. Thanks for this lesson. “If” statements are great programing tools.
After seeing this comment, I felt jealous and I tried it, and it worked. LOL
Great lesson again thanks Paul.
I practice by having a crack at it purely from memory (fail). Then I go back to previous lessons and check the syntax of the IF statement (still fail!). Then I check your solution and work my way through it with you - SUCCESS!
Initially I missed the '=='.
Then I had placed the 'Serial.readString' BEFORE each if statement (fail!).
I amended (complicated!) my procedure a little by combining two different read statements:
1. asked what is your name?
2. used that string in another sentence and asked 'name' to choose which LED they wanted ON.
3. Turned that LED on, then gave them a confirmation message with the LED they had chosen in the final msg.
4. wrote a delay then turned ALL LED's OFF.
Love your work thanks!
Another enjoyable video Paul. Lessons are getting more fun having more control from the keyboard.
Did some head scratching for a few minutes. I am learning so much and just want to thank you. Some people have ability to code and etc. however they cannot teach. I love the way that you simplify things for all to understand. Thank you Paul
Great job!
This was fun 😊 and it's not me I always hold my breath. Great lesson, I learned some new tricks. Thank you Mr. McWhorter.
Paul, Another great lesson! I was barking at my screen during lesson 18 and 19 because you didn't do a pinMode! I wasn't expecting the LED to come on. Was very surprised when came on and was dim.
Forgot the ==. Lot of fun going through it trying to find out how I messed up and learning from it.
I always thank God for bringing your videos to my intention I pray you that you continue enlightening us upcoming engineers
Thank you very much for these tutorials, I've been following along and found you to be an excellent teacher. Please keep these excellent tutorials coming
I like that we stick to the basic code for these examples so we fully comprehend what is being taught. Using extra functions that convert to lower case etc is best left for later just like you are doing to avoid confusion. Thanks
Thanks Paul! Really enjoying your series of tutorials. One question though: I'm just wondering why you are not setting up your wiring using the same column for resistor and LED, then using a common (-) to plug all the LED's into. I've found it much easier to just jump the resistor across the trench and plug the LED into the numbered column and the common (-) row.
I think when using green and blue they have different voltage drop.
Still here and enjoying all the tutorials. So motivated, I bought an Arduino R4. As always, thank you so much.
"BooM"
Hello Paul,
Your channel is the first one that I have subscribed to, I am an Electrician from London, England with a bias toward control Engineering. When I watched your first video on the Arduino I thought that you was taking a while to explain things, but going through the different episodes your in depth explanations are the right way to teach.
Thank You for sharing your knowledge
Stuart Hill
London, England
It works! It took me 3 days but I got it. I could use a refresher on those darn () and {}!
I paused the video and did the circuit work without a hitch, did the pinMode setups but had a hard time trying to figure out how to get just ONE LED to come on at a time. I finally gave up and followed your program. Such an awesome class! This one was very cool! And just think...they are just going to get cooler as we go along!
Hi everyone! Thanks Paul for teaching an old dog some new tricks!!! Until this one I was doing very well but this time it took several hours for me to figure out the serial monitor setting had to be changed to 'no line ending' before it would work. I was so sure it was my coding. Thank goodness a poster mentioned it here. Thanks and keep doing what you do!!! God bless!! :D
What would happen if it wasn't changed? I'm having an issue where it asks what color then when I enter a color nothing comes on
Hi Paul
I'm usually shy about comments/Internet but I was passing through comments anyway, in search of the "No Line Ending" fix for the Serial Monitor. I had finished this lesson and lesson 20 (in case I simply coded improperly during 19). Thankfully, I found the fix quickly.
So here I am after 20 lessons and I'm compelled to leave you this message:
you are fantastic. You are a part of my daily life to the extent I will say things to my wife, like "gotta get back to Mr. McWhorter's class." You seem interested in who/what your viewers are/doing - and I'll keep this short - so here are just a few bullet points.
I'm 51. Married. Started all this to generate interest for teenage child. I immediately assumed you were a teacher. I'm actually married to a teacher. More interestingly: after lessons and while paused I usually tweak the code to include more and different things, as I have wrapped my head around them, due to your "class." Sometimes I feel like I am the "teacher's pet" and other times I feel like I am the class smart-guy. Most importantly I believe my "feels" are a testament to how wonderful and personal your videos are.
Please keep going. I'll be watching and learning. Thank you for the incredible gift that is The Arduino Tutorials.
PS
is that really coffee in your mug? Just kidding.
When I'm not learning to code, I'm all about the coffee here at home. From pumping Espresso to French Press to Cold Brew and everything in between. I'm fortunate in that I live close to a local roaster with beans from around the world and sometimes I wonder if you've had any first-hand interactions with beans/farmers.
Anyway, thank you, again!
Thank you for your kind words, they are a real encouragement to me.
I used the toUpperCase() function and then just tested the string against it's uppercase value in the if statement. Also set a flag if the colour choice was a valid entry and tested it at the end of the code which displayed an error message if red, green or blue had not been entered and of course reset it after the error message. I found this tutorial very useful as a step in the right direction to controlling actions through the Arduino IDE. Thanks for your efforts Paul.
Didn`t read the part about setting the serialMonitor to "No line ending". Was going absolutely nuts trying to figure out what was wrong,lol. Rewrote the whole thing a few times until i finally saw the comments. My board almost went flying out the window here hahaha.
Another great video Mr.Worther. thank you for your dedication :)
What do you know, I spent the whole day coding with Paul. Time flies when you're having fun.
This is a Great tutorial on using Arduino for a beginner like my self. Only one thing I miss in your tutorial was on COM PORT setting. Got the port setup on the right USB, and the right Baud Rate of 9600 , but I did find out that the line feed has to be in "no line ending" to work correctly. That little set back made me go thru my program looking for my error in code . Looking for all the info i could find on WHILE statement thinking i had something wrong. It was my son that saw my mistake and showed me how to fix it. SO FOR YOU BEGINNER MAKE SURE YOU ARE ON "no line ending" IN YOUR COM PORT,
I had the hardest time getting this to work...i started and stopped the video more times than I can remember...I changed the values to match his exactly. I started looking into the comments and found this. I changed that setting and it worked immediately. THANK YOU for posting this. I was going absolutely nuts trying to get this working.
Thanks a lot for that great lesson!
I really liked your assigment and did it a little bit different, for example I set all 3 LEDs to LOW right after the wait loop and than only set the on LED to high that the user submitted. I also made an error message if the user submitted anything else than red, green or blue in lowercase.
For those who are interested, here is my code:
int rLED = 12;
int gLED = 10;
int bLED = 8;
int dt = 200;
String onLED;
String msg = "What color do you like? You can choose from red, green and blue.";
String msg2 = "The ";
String msg3 = ", LED is now powered on!";
String msg4 = "Error! You can only choose from red, green and blue. Keep in mind that your input is case sensitive!";
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(rLED, OUTPUT);
pinMode(gLED, OUTPUT);
pinMode(bLED, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println(msg);
while (Serial.available() == 0) {
}
digitalWrite(rLED, LOW);
digitalWrite(gLED, LOW);
digitalWrite(bLED, LOW);
onLED = Serial.readString();
if (onLED == "red") {
digitalWrite(rLED, HIGH);
Serial.print(msg2);
Serial.print(onLED);
Serial.println(msg3);
}
else if (onLED == "green") {
digitalWrite(gLED, HIGH);
Serial.print(msg2);
Serial.print(onLED);
Serial.println(msg3);
}
else if (onLED == "blue") {
digitalWrite(bLED, HIGH);
Serial.print(msg2);
Serial.print(onLED);
Serial.println(msg3);
}
else {
Serial.println(msg4);
digitalWrite(rLED, HIGH);
digitalWrite(gLED, HIGH);
digitalWrite(bLED, HIGH);
delay(dt);
digitalWrite(rLED, LOW);
digitalWrite(gLED, LOW);
digitalWrite(bLED, LOW);
delay(dt);
digitalWrite(rLED, HIGH);
digitalWrite(gLED, HIGH);
digitalWrite(bLED, HIGH);
delay(dt);
digitalWrite(rLED, LOW);
digitalWrite(gLED, LOW);
digitalWrite(bLED, LOW);
}
}
I struggled for hours to get mine to work . Then I read the comment make sure you have 'no line ending' in the serial monitor box. Then BOOM it worked. Thanks InvisibleHero. Thanks too Paul. great Series.
Was almost going to give up in frustration. Thank You buddy.
thank you so much,this comment is lifesaver
I was stuck on this for a while. I even had to take a break from this lesson. It really helps that you dont put ";" after the if condition.Thank goodness I found this. Thanks for the lessons!
Ha!!....I did the same darn thing! Feels great when one finally figures it out!
Very nice tutorials Paul. Have been following this tutorial for a few days now and will be following till the end. A year after this was uploaded and still I find this very helpful. Thank you so much for your time and effort! Love them all. We need more people like you. Thanks a lot once agian!
Another instructive tutorial Paul, keep up the great work. As mentioned earlier I'"chucked in the towel" at my last attempt, but I think I may be past the "towel chucking" stage now
All down to you mate!!!
The IF statement kept changing the "myColor" after about a half an hour I remembered to put == and not=. It was quite challenging. It worked perfect after the correction. Thank you Paul.
I'm glad you explained how the breadboard works. I use one ground just by connecting the negative rail. That way I use one ground on the Arduino and hook all the LEDs to the negative rail.
So fun to play along. Thanks again for another great lesson! I added some other responses like "You picked GREEN!" as well as a delay for how long the light stayed on. After the light turns off another message that says "You did it! Thanks for playing." I wanted to add further instructions if the CAPS were incorrect and got close but was unable to make it work correctly. I'm sure we will cover this in the future. Good luck everyone!
Mine says, "You selected: " and then myColor. I was troubleshooting the problem that was corrected with the selection for No line ending. Still, my adding the extra 2 lines of code told me my problem was not with the while line.
Hello, Paul! For the 3 LEDs light up, I initial used 3 "while" loops instead of 3 "if" loops. It ended my program would not loop back. It only asked the question once and then lighted the LED up accordingly, and no more actions afterwards. After watching your solution, I changed all three "while" words to "if" words. It looped back ☺. Now I think I gained better understanding the differences between "if" and "while". Thank you!
Prof McWhorter,
Forgot to add that your presentations are excellent. I am a former college professor and you provide an excellent presentation.
When I did the assignment, I added an if statement that on any misspelling or capitalization an error message would be generated asking the user to try again. I'm 73 and learning Arduino coding through your videos. Many thanks.
This one I couldn't get working on the first try. My reasoning was correct, but I made two mistakes in the code.
The first mistake was not using == inside the If statement. I ended up googling about If statements as a refresher and there I saw the error.
The second mistake was that I did think about including the capitalized version of the color, but I wrote it < if(color=="red" || "Red") > and it did not work like this. This I couldn't figure out until I saw the rest of the video. All in all, a super fun lesson.
The trademark "BOOOM" always liven up the lessons. No one will unsubscribe you. I will stay with the lessons, all of them. I now carry a small box and cable around and practice the lessons in fast food places, using my mobile phone version of IDE. Many thanks Paul Sir.
Thanks for making these videos. I’m learning so much!
Thank you, I'm slowly seeing how we can use these in different setups. For example I could turn "blue" to "Lamp" and just plug in a lamp to the setup. It's great seeing this little board come to life.
This has been a great way to unify all the stuff we've been learning up till now. When I originally started trying to solve this, I wanted to turn myColor into an int, and then have the user select a number instead of typing in a word because I was worried about what would happen if they didn't type in the word exactly as expected.
I'm definitely finding a great deal of value in this tutorial series, and can't wait to find out how to create an exception for when people don't use the exact command properly.
This was a fun challenge! I loved figuring out myself how to send a message if the input command was in the wrong format, and adding a secret command to turn on all three LEDs. Love the series!
I love it too, it is not only good for sending and receiving data but it is good for debugging, which is a really useful thing.
Samuel
Success!! I did it. Slightly different but same result. I used options 1 to 3, to avoid typing issues.
I found this tutorials some days ago and i´m already in tutorial 19. I feel so pleased. Thank you Mr McWhorter.
I really appreciate your teaching. I was not getting the desired output until I checked the comments and the video caption. I appreciate the way you try to solve our doubts . We are blessed to have a great teacher like you! Thank you!😄
Wonderful!
I set my LED's up so that the GND legs are all in the outside bus. That way only one GND wire is needed. Makes it a lot easier and neater. Thanks for the BRILLIANT tutorial.
I've noticed this 19 lessons in. I've been following your instructions almost exactly. The main difference is that I use my own variable names. The thing I noticed is that it makes me think a little more and sort of forces me to troubleshoot on my own without just looking at your code and copying it exactly. I tried looking back and forth and thinking "Okay, so I used this name instead of the name he used, so I should find every time he wrote his and match it up with mine and make sure it follows." That was difficult going back and forth and back and forth like that. Having my own variable names forced me to think for myself and try to find out where I went wrong with something. I think that'd be a great thing to suggest in your videos so people can try to think on their own.
I added another interactive input asking for the number of blinks you want (for the selected LED color).
You can copy and paste Paul's if statements, and put them in a for loop. Very fun.
Thanks Paul!
I even put an || with RED, GREEN and BLUE!!
Great class!
Additionally, as a former events technician who has trained up and coming techs, I think your attitude to mistakes is fantastic. Making mistakes happens most days, and it's so important to just be comfortable to go 'whoops, that was my fault.'
I couln't make the exercise asked at begining. But during the lecture I came to a point where I was able to complete well the program by adding ; "Your Led Color is" then "red,green, or blue"; add also a 3 second delay to put led LOW at the end of cycle. Stuff is getting to comprehension to me. Thank you Paul.
I never feel boring while listening to you. I have learned a lot. I understood things well because of your style. Thank you so much.
Paul, really enjoy when you give us projects to try on our own. They help me test my retention of the tutorial and gives me a chance to think about what I've learned. Very beneficial!
I did the assignment and I loved it. Added a few of my own commands as well. Thank you very much for these videos Mr. McWhorter
I did the assignment a little differently, in my program instead of just turning LEDs on, it blinked the LEDs 5 times, I used a for statement inside each if statement for blink the LEDs. And yes, I did not forget to use variables. Great videos keep up the good work sir.
I completed the lesson with flying colors! I love this. I made it so you can turn the LEDs on and off, they can be on at all different times, and i can turn them all off/on at one time! 🥰
Spent more than one hour troubleshooting for this lesson. If I didn’t read the description in this video I would have spent another one hour.
“No line ending.” Please set your serial monitor guysss.
After that you can hold your breath and say ,”BOOOM it works!”
Wow, I got it. This was a tough assignment. I took a break to work on other projects, so I had to go back to lesson 12 to remind me how the "if" statement needed to be laid out.
Thank you, Paul! I have learned the importance of reading the description! Spent an hour trying everything i could think of, lol
Fantastic!
Thank you Sir, I am a 13 year old Student from Punjab (India) and love watching your videos as they teach a lot about Arduino boards as I always wanted to learn to use them.
Excellent!
Omg. Just as i was experiencing it, (my LED was so dim i thought I got the connections wrong) that sir Paul got his dim too! So i was so happy he mentioned the pinMode that i also forgot.
I have a pretty good foundation for programming from years of messing around with game engines like Unity and Godot but it's nice to have someone teach so thoroughly the concepts needed to apply that to physical hardware like an Arduino. Love your teaching style - very easy to follow and understand in relatively short lessons. This dad in his 30's appreciates your time and energy creating this series!
I have added in my programming clauses to turn off the LEDs and an Error msg if wrong colors or text is inputted by the user. I am new to programming and arduino's. These courses are very interesting. I have followed them since course 1 and will continue on. Thank you Mr. McWorther.
Paul, I have not seen all of your videos and maybe you have figured this out between the time of posting and now, but if you need to change one word, such as HIGH to LOW, you can double click on that word to highlight it. Makes the copy paste go a bit faster. You can then copy LOW and quickly paste it everywhere the change is needed...etc. Thanks again for your lessons!!!!!
This was driving me crazy. It seemed like none of my digitalWrites were working. Checked the circuits and with 5v to each resistor and the LED worked! But the digital output wasn't there. Tried everything I could think of, but nothing worked
Then, I saw the "No line ending" phrase appearing in the comments. Changed that and "BOOM," it works!
Was this in a lesson and I missed it? Oh, well. I'm enjoying this course tremendously. One thing I've learned is to minimize wires by using the rail busses. I find that more convenient, personally.
Keep up the good work, Paul. I'm on lesson 24 and having a ball. I teach power plant operations and plant simulator training which includes a lot of electrical theory and digital controls. I appreciate your teaching style and your expertise. Also, plan to make some videos, using the Arduino, to help teach basic electricity and controls. Again, great job. Looking forward to future lessons.
If I had teacher like you in my school days, I 'might' have become an engineer! I am amazed at the clarity of your teaching, humanity and most of all your generosity. I am following your Arduino lessons, now at lesson 19. I can not say that I can repeat what I learned yet, but I will get there.
I have an idea about aviation security programming that I would like to run by you, it has the potential to save numerous lives. Please contact me.
This is a good one! I added a portion that tells the person if it's not one of the expected strings and loops back to enter a color again.
I'm 62 and just learning the Arduino. Your tutorials are the best. You explain things very well. Your teaching style is second to none and even when you make mistakes to test me it really helps me to work out the issues. I watch every lesson and faithfully do the assignments and the work along with you. Can't wait until I finish this set and move on to another one of your tutorials - most likely Python. Additionally, there's a teen in my town that wants to be an Engineer and I've given him the link to your channel. FYI I'm in Australia so my purchases go through the Aus store. Any other way to support your excellent work?? Cheers from down under :-)
I’ve been following along to these videos using an Arduino Mega 2560 kit from Elegoo. These are the best lessons to learn Arduino. I just can’t drink iced coffee. It has to be hot.
The few minutes of coding that weren't on the screen (ep 19) was no a problem as Paul explains it so well anyway!
Dear Mr. McWhorter,
thank you very much for the tutorials!
Please keep up the good work!
Thx for another great lesson and assignment Paul. Here is how i did it, i used if, else if and else instead.
int redLED = 10;
int greenLED = 11;
int blueLED = 12; //LED 13 operates together with internal LED and shows strange behavior
String msg = "What color LED would you like me to turn on? ";
String msg2 = "Options are 'red', 'green, blue or all: ";
String msg3 = " is turned on !!!";
String msg4 = "Not a valid color";
String ledColor;
String red = "red";
String green = "green";
String blue = "blue";
String all = "all";
void setup() {
// put your setup code here, to run once:
pinMode(redLED, OUTPUT);
pinMode(greenLED, OUTPUT);
pinMode(blueLED, OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println(msg);
Serial.println(msg2);
while (Serial.available() == 0) {
}
ledColor = Serial.readString();
if (ledColor == red) {
digitalWrite(redLED, HIGH);
digitalWrite(greenLED, LOW);
digitalWrite(blueLED, LOW);
Serial.println(ledColor + msg3);
}
else if (ledColor == green) { // if would also work !!!
digitalWrite(redLED, LOW);
digitalWrite(greenLED, HIGH);
digitalWrite(blueLED, LOW);
Serial.println(ledColor + msg3);
}
else if (ledColor == blue) { // if would also work !!!
digitalWrite(redLED, LOW);
digitalWrite(greenLED, LOW);
digitalWrite(blueLED, HIGH);
Serial.println(ledColor + msg3);
}
else if (ledColor == all) { // if would also work !!!
digitalWrite(redLED, HIGH);
digitalWrite(greenLED, HIGH);
digitalWrite(blueLED, HIGH);
Serial.println(ledColor + msg3);
}
else {
Serial.println(msg4);
}
}
You are the best teacher ever. This was a really fun lesson!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Love the errors, even the unintentional ones. Debugging is just as important as coding. Thanks, Paul! Keep up the great work!
The assignment was a good brain teaser, thank you! Turns out the mistake I made was not putting quotations around my color variables inside my if statements, leading to blue being constantly lit no matter what color I typed. I also added a message after entering a color that said "Activating (color) LED now!" on a new line :)