Arduino Tutorial 19: Reading Strings from the Serial Monitor

Sdílet
Vložit
  • čas přidán 29. 07. 2019
  • GUYS MAKE SURE YOUR SERIAL MONITOR IS SET TO 'NO LINE ENDING'!!! Otherwise you will have problems with this code.
    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 read Strings, or words, over the Arduino Serial Monitor. Enjoy!
    You can get the following Elegoo kit, to follow these lessons and play along at home
    amzn.to/3c9SJrO
    You guys can find more great arduino content on my web site at:
    toptechboy.com/arduino-tutori...
    [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
  • Věda a technologie

Komentáře • 1K

  • @cameronburrell6809
    @cameronburrell6809 Před rokem +27

    I’m 12 years old and starting to get into engineering and your tutorials have helped me a lot, thank you!

    • @paulmcwhorter
      @paulmcwhorter  Před rokem +23

      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.

  • @alanbolek4364
    @alanbolek4364 Před 3 lety +94

    I learned a hard lesson on "no line ending" Its one i will not forget! Amazing lessons!!

    • @TimberTechWorkshop
      @TimberTechWorkshop Před 2 lety +6

      That was my problem too.... thanks for the heads up that solved my problem

    • @charlielowell4077
      @charlielowell4077 Před 2 lety +4

      I did too! Couldn't figure out why it wouldn't work.

    • @adamhorn8414
      @adamhorn8414 Před 2 lety +2

      this one got me too

    • @ryanbrownie4634
      @ryanbrownie4634 Před 2 lety +3

      Thank alot for this had me stuck for hours😣

    • @Bachulia
      @Bachulia Před 2 lety +1

      I need felp no line ending where?

  • @bigstickpilot
    @bigstickpilot Před 4 lety +275

    I discovered that the serial monitor window has to be set to "no line ending" or I get uncommanded line returns

    • @jeremyvandenheuvel5621
      @jeremyvandenheuvel5621 Před 4 lety +19

      same problem, took me two days

    • @stefanfarier7384
      @stefanfarier7384 Před 4 lety

      わたしも。。。

    • @coledunlay7876
      @coledunlay7876 Před 4 lety +4

      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!!

    • @kayboku7281
      @kayboku7281 Před 4 lety +6

      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.

    • @jonnyjohnson5025
      @jonnyjohnson5025 Před 4 lety +4

      I was having that problem too! Thank you for sharing! I was really annoyed at that.

  • @girishtripathy275
    @girishtripathy275 Před 4 lety +149

    I seriously feel guilty for not holding my breath everytime his code bugs.

  • @geekgloryenglish2822
    @geekgloryenglish2822 Před 3 lety +21

    We gotta protect Paul.
    He is too Precious.
    Love you Paul!!

  • @Fractal_CZ
    @Fractal_CZ Před 2 lety +7

    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.

  • @fishseagull8504
    @fishseagull8504 Před 4 lety +67

    These are the best Arduino tutorials on the entire internet. I love your style of teaching especially your intentional mistakes. Thank you so much!

    • @dimpledharamsi7704
      @dimpledharamsi7704 Před 2 lety +1

      yes exactly , the intentional mistakes make sure that we learn well. Thanks sir!

  • @jonaldtrumpeno
    @jonaldtrumpeno Před 2 lety +14

    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. 😁

  • @meJoKeR65
    @meJoKeR65 Před 5 lety +56

    gotta love Paul's reactions to his intentional mistakes

    • @jaytalbot1146
      @jaytalbot1146 Před 3 lety +1

      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

    • @midnightrizer
      @midnightrizer Před 3 lety

      @@jaytalbot1146 i agree :)

    • @RDayan932
      @RDayan932 Před 3 lety

      @@jaytalbot1146 Even though I agree, I feel like for a total newbie who has ZERO experience coding, those repeated errors are very helpful.

    • @royeubanks639
      @royeubanks639 Před 3 lety +2

      "intentional" right ;) Like Inspector Clouseau: "I was just testing you"

    • @tedparker640
      @tedparker640 Před 2 lety

      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.

  • @lucasmark9656
    @lucasmark9656 Před 2 lety +3

    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!

  • @thyBeren
    @thyBeren Před 3 lety +18

    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.

  • @rebeccadoherty3193
    @rebeccadoherty3193 Před 3 lety +4

    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!!!!

  • @colepdx187
    @colepdx187 Před 5 lety +16

    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.

    • @paulmcwhorter
      @paulmcwhorter  Před 5 lety +2

      Sounds like a productive month!

    • @thanoslampropoulos8132
      @thanoslampropoulos8132 Před 5 lety

      @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.

    • @paulmcwhorter
      @paulmcwhorter  Před 5 lety +9

      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.

    • @colepdx187
      @colepdx187 Před 5 lety +3

      @@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 CZcams 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.

    • @thanoslampropoulos8132
      @thanoslampropoulos8132 Před 5 lety +5

      @@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!

  • @fizamaqbool13
    @fizamaqbool13 Před 3 lety +3

    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!!

  • @autocrosser10
    @autocrosser10 Před 8 měsíci +1

    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.

  • @TheScissorunner
    @TheScissorunner Před 4 lety +2

    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!

  • @D3M0320
    @D3M0320 Před 4 lety +17

    These tutorials are fantastic and make me WANT to learn more!

  • @ericness9660
    @ericness9660 Před 3 lety +5

    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.

    • @mileshester6939
      @mileshester6939 Před 2 lety +1

      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.

  • @ccastle1049
    @ccastle1049 Před rokem +2

    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!

  • @JerseyEmpireGroup
    @JerseyEmpireGroup Před 4 lety

    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!

  • @saeidr.hirbodi9927
    @saeidr.hirbodi9927 Před 5 lety +3

    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,

  • @erygion
    @erygion Před 4 lety +6

    This was fun 😊 and it's not me I always hold my breath. Great lesson, I learned some new tricks. Thank you Mr. McWhorter.

  • @davidamadeo
    @davidamadeo Před 3 lety +1

    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!

  • @michaelcostello6991
    @michaelcostello6991 Před 4 lety +1

    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

  • @opalprestonshirley1700
    @opalprestonshirley1700 Před 5 lety +4

    Another enjoyable video Paul. Lessons are getting more fun having more control from the keyboard.

  • @daveharkin4731
    @daveharkin4731 Před 5 lety +3

    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

  • @sse8033
    @sse8033 Před 3 lety

    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.

  • @davidquichocho1351
    @davidquichocho1351 Před 4 lety +1

    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!

    • @dpetervan
      @dpetervan Před 3 lety

      Ha!!....I did the same darn thing! Feels great when one finally figures it out!

  • @geralddrake4617
    @geralddrake4617 Před 3 lety +3

    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.

    • @muhammadtamim451
      @muhammadtamim451 Před 3 lety +1

      After seeing this comment, I felt jealous and I tried it, and it worked. LOL

  • @codyfreeman4835
    @codyfreeman4835 Před 4 lety +5

    Forgot the ==. Lot of fun going through it trying to find out how I messed up and learning from it.

  • @ianbirkinhead4103
    @ianbirkinhead4103 Před 4 lety

    I love that you make mistakes and troubleshoot in real time. 1 it gives me more confidence to also make mistakes, but most importantly it makes me think of process. Great tutorial.

  • @blazehawkins2759
    @blazehawkins2759 Před 2 lety +1

    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.

  • @karll.masoner6918
    @karll.masoner6918 Před 5 lety +13

    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);
    }
    }

    • @okann_hasan
      @okann_hasan Před 2 lety +2

      The point of this was learning to use strings

    • @marcelomarquesrangel
      @marcelomarquesrangel Před 2 lety

      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();
      }
      }

  • @robjameson7965
    @robjameson7965 Před 4 lety +4

    Hi Paul,
    Just writing from Liverpool in England.
    First time I've ever bothered subscribing to a CZcams 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!

  • @grathado28
    @grathado28 Před 2 lety

    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.

  • @stilesmcgraw
    @stilesmcgraw Před 3 lety +1

    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!

  • @louandpaulanickles7172
    @louandpaulanickles7172 Před 4 lety +4

    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.

    • @siamaknaimi8416
      @siamaknaimi8416 Před rokem

      I think when using green and blue they have different voltage drop.

  • @believer3759
    @believer3759 Před 4 lety +2

    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

    • @Jaso2779
      @Jaso2779 Před 3 lety

      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

  • @audreyflores243
    @audreyflores243 Před měsícem

    Still here and enjoying all the tutorials. So motivated, I bought an Arduino R4. As always, thank you so much.

  • @ha13151
    @ha13151 Před 5 lety +30

    "BooM"

  • @leocallejas
    @leocallejas Před 3 lety +2

    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.

  • @dimpledharamsi7704
    @dimpledharamsi7704 Před 2 lety

    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!😄

  • @SukhdevSingh-tp4mg
    @SukhdevSingh-tp4mg Před 4 lety +2

    Seriously better than any costly course , just free knowledge

  • @tuptupbre
    @tuptupbre Před 5 lety +3

    Dear Mr. McWhorter,
    thank you very much for the tutorials!
    Please keep up the good work!

  • @Kyldrake
    @Kyldrake Před 3 lety +1

    What do you know, I spent the whole day coding with Paul. Time flies when you're having fun.

  • @joevaclavik4427
    @joevaclavik4427 Před rokem

    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

  • @RavensHammer00
    @RavensHammer00 Před rokem +1

    Thanks, Paul. This stuff is great! It's really clicking for me, your teaching style apparently works ideally well for someone like me! Can't wait for more, but I'm limiting myself to two lessons a day and handwriting the coding as well as putting it into IDE, so it really sticks, if you know what I mean. Thank you for putting this kind of content out there, I wish more people had this kind of talent they were willing to share and were as adept at sharing that knowledge!

  • @octogintillion
    @octogintillion Před rokem +1

    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!

    • @samueltheprogrammer6145
      @samueltheprogrammer6145 Před rokem

      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

  • @squeakal3393
    @squeakal3393 Před 3 lety +2

    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.

  • @yolandagonzales100
    @yolandagonzales100 Před 2 lety

    Hello, Last Summer I found your Arduino Lessons. You do a great job of teaching! Before finding you I had never touched a micro-controller, but I had done some programming. I learned enough from you to teach my Computer Programming Club at our local Middle School (an after school thing). I went as far as lesson 15 last summer. In the last week, I have redone those and learned more the second time around. Thank you for taking the time to share your knowledge - I am in turn, sharing it with my students.

  • @markfuentes3666
    @markfuentes3666 Před 4 lety

    Loved this project. Was able to do it on my own thanks to all of your videos. Thank you.

  • @jeffyule4709
    @jeffyule4709 Před 3 lety

    Fantastic videos Paul thank you so much! When you hit your iced coffee I change the CZcams speed playback to 1.5 to try to get through them quicker. Of course I can always go back and review if needed. I love your passion and the way the lessons build upon each other.

  • @MrZodiacmark
    @MrZodiacmark Před 7 měsíci

    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

  • @timsavage8624
    @timsavage8624 Před 2 lety

    Love the errors, even the unintentional ones. Debugging is just as important as coding. Thanks, Paul! Keep up the great work!

  • @persoonsaini4794
    @persoonsaini4794 Před 4 lety

    Good you have a teacher as you Paul. Thank you for educating us the fun way. Boom!!!

  • @franciscoserafim7793
    @franciscoserafim7793 Před rokem

    I found this tutorials some days ago and i´m already in tutorial 19. I feel so pleased. Thank you Mr McWhorter.

  • @tonyperry6702
    @tonyperry6702 Před 4 lety

    Paul, going back through your lessons. Good stuff the second time around.

  • @supernovic99
    @supernovic99 Před rokem

    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

  • @marksnell3871
    @marksnell3871 Před 3 lety +1

    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

  • @barryhibben8665
    @barryhibben8665 Před 4 měsíci +1

    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!!!

  • @brucelauder7516
    @brucelauder7516 Před 3 lety

    WOW! this one took some time but did it! Needed to re-watch a couple videos to refresh my memory, great tutorial I would not have been able to do this prior to watching this series.

  • @raymondjonkers104
    @raymondjonkers104 Před 3 lety

    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 !

    • @douglasmckinley-sr1507
      @douglasmckinley-sr1507 Před 3 lety

      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.

  • @daniellehwing4667
    @daniellehwing4667 Před 6 měsíci +2

    I even put an || with RED, GREEN and BLUE!!
    Great class!

  • @iandawkins2182
    @iandawkins2182 Před 5 lety

    Another great learning video, you are just getting better and better. Learning so much and sketches upload a lot better now I hold my breath :-))

  • @anthonyj.dipasqua4676
    @anthonyj.dipasqua4676 Před 3 lety +2

    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!

    • @mileshester6939
      @mileshester6939 Před 2 lety

      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.

  • @grazianoturbogas
    @grazianoturbogas Před 4 lety

    I've loved it! Thanks Teacher! (I'm an engeneer so don't take it for granted, You've worhted Mr. Mc Whorter!) Hugs from Italy! :-)

  • @johndavid360
    @johndavid360 Před 3 lety +1

    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! 🥰

  • @vortexkl
    @vortexkl Před 4 lety

    Great tutorial again and am happy to report that I managed to do the assignment on my own without peeking. :-)

  • @abhik1493
    @abhik1493 Před 4 lety +1

    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);
    }
    }

  • @czmg22
    @czmg22 Před 2 lety

    Thanks for the lesson, having so much fun with this.

  • @diessos
    @diessos Před 2 lety

    Love these tutorials. I've had an arduino for a while but have no electrical background. So this helps me to understand how to wire things up. I have an extensive programming background to that comes quite easy for me. Looking forward to the remaining tutorials

  • @stewarthartley7613
    @stewarthartley7613 Před 2 lety +1

    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.

    • @prathamsaboo5190
      @prathamsaboo5190 Před 2 lety

      Was almost going to give up in frustration. Thank You buddy.

    • @khevsu6139
      @khevsu6139 Před 2 měsíci

      thank you so much,this comment is lifesaver

  • @RahulMishra-ov4nr
    @RahulMishra-ov4nr Před 2 lety

    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.

  • @tacowithgiantbeansallover

    There is a neat function you can use to avoid having to type all of the possibilities of capitalization for your if() statements. It is "stringName.toLowerCase()", stringName being the name of your string. Very useful.

    • @mileshester6939
      @mileshester6939 Před 2 lety +1

      I would bet money Paul knew about this but elected to save that for another lesson to keep this one a little simpler and to the coveted half hour range.

  • @mauricedangerman6506
    @mauricedangerman6506 Před 3 lety

    Dear Sir McWhorter,
    These videos are amazing. At the start I did not anything about programming within Arduino. However, for my graduation I have to write quite a big and complex script. Thanks to your videos I have the confidence that I will manage.
    I do not know if your Ice Coffee consumption can be deemed healthy, but if it helps you to make these great videos, please keep drinking them!!
    I hope to see more of your content in the future. Keep up the good work.

  • @ianrickard9480
    @ianrickard9480 Před 2 lety +1

    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);
    }
    }

  • @Bristoll170
    @Bristoll170 Před 4 lety +1

    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.

  • @aaronmilliman7685
    @aaronmilliman7685 Před 2 lety

    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.

  • @madskillz98258
    @madskillz98258 Před 3 lety +1

    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.

  • @gustavovd
    @gustavovd Před 5 lety

    Hi Paul. Just so you know, some people out there LOVE you and your videos. Thank you!

  • @modelrailwaytheeasyway9743

    Well Paul I have been playing a long and had the Arduino for a week so far and already started to complete my first project to control 3 relays and 7 leds for an reverse osmosis water supply controller. May not be the best bit of coding but it works and it’s all been learnt from your series so far. Before I have been using python. But wanted to give an Arduino a try. Your a star teacher. Only 40 more lessons to go.

  • @timcallsen4429
    @timcallsen4429 Před 3 lety

    I really enjoy this lesson Thanks Paul hope to see more in the future

  • @mixipilixi
    @mixipilixi Před 4 lety

    this is great stuff! Your videos are addictive! I spend many hrs a day lwatching your videos and learning. Keep it up! and Thanks!

  • @Aniven79
    @Aniven79 Před 3 lety

    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 :)

  • @allanpatterson7653
    @allanpatterson7653 Před 4 lety

    Interesting, I sit through even the ones I know well because you have managed to make them interesting.

  • @JCork
    @JCork Před rokem +1

    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 :-)

  • @johnnyvegastrading1694
    @johnnyvegastrading1694 Před 7 měsíci +1

    Thanks for making these videos. I’m learning so much!

  • @richardbritain7435
    @richardbritain7435 Před 2 lety

    Success!! I did it. Slightly different but same result. I used options 1 to 3, to avoid typing issues.

  • @robbrown1520
    @robbrown1520 Před rokem

    Thank again for the great tutorials. I am most defiantly watching!

  • @wendygrant2735
    @wendygrant2735 Před 2 lety

    I played along at home, today. Thank you very much.

  • @thomashoffmann5603
    @thomashoffmann5603 Před 2 lety

    Yeah best lessons ever wish I knew about these back when I was doing embedded in UNI! I love you Paul!

  • @grafophone
    @grafophone Před 3 lety +1

    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.

  • @coreykennett8572
    @coreykennett8572 Před rokem

    Great lessons Paul, having a blast with them, love the use of math in your lessons also.

  • @user-ys6bc7yh7z
    @user-ys6bc7yh7z Před 10 měsíci

    Thank you so much. Made a lot of mistakes during the assignment, but it was completed! It was a great refresher of if statements.
    Also thank you very much for showing how to check the connection of the LEDs. It was very useful.

  • @lanceanderson7533
    @lanceanderson7533 Před 3 lety +2

    Hi Paul. I have to admit that I had to watch how you coded the "if" statements but it all made sense once I saw it done. Obviously I need to spend a little more time on reviewing your lessons. I did have my pinMode statements done before watching your coding though : ) Thanks once again for another great lesson!

  • @max_dee
    @max_dee Před rokem

    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!

  • @pierret00
    @pierret00 Před 4 lety +1

    You're such an amazing and hilarious teacher! I guess truly passionate teachers are much better than didactically correct teachers who don't get those excited smiles elicited from their pupils. Keep the great work going! It's rare to find such valuable lessons on CZcams besides KhanAcademy.

  • @trumpatier
    @trumpatier Před 3 lety

    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 :)

  • @DjHattR
    @DjHattR Před 3 lety

    This one was a great one for me! I was one step ahead, until the very end where I had forgotten to set my Serial Monitor to No Line Ending!!

  • @mohsenr4434
    @mohsenr4434 Před 2 lety

    The assignments are simple and helpful, thanks a lot!