Это видео недоступно.
Сожалеем об этом.
Arduino Tutorial 18: Reading Numbers from the Serial Monitor
HTML-код
- Опубликовано: 18 авг 2024
- 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 get user input on the arduino from the serial monitor. We learn about the parseInt() and parseFloat() commands. Enjoy!
You can get the following Elegoo kit, to follow these lessons and play along at home
amzn.to/3c9SJrO
Find more great Arduino Content on our WEB site HERE:
toptechboy.com...
[Disclosure of Material Connection: I am a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com. This means if you visit the link and purchase the item, I will receive an affiliate commission. Regardless, I only recommend products or services I use personally and believe will add value to my readers.]
#Arduino
Guys if you are having trouble, make sure you have your serial monitor set to "No Line Ending". Otherwise you can get unpredictable results.
Good one there. I entered the code as you explained it, then paused the video before you executed it. My sketch compiled and loaded fine. It took me a while to figure out that I had to click Send or Enter to execute the read. I had the serial monitor set to "Both NL and CR", and the Serial Monitor would print an extra line saying "Your Number is 0"! Changing to "No Line Ending" fixed it. BTW, this lesson covered new stuff for me, had never seen Serial.available or Serial.parse before. Keep challenging us!
omg this was my problem tytytytytytyty lol
Thank you Paul, you are a great teacher. I was wondering, the setting we had to choose was "No line ending", is it also possible to add a line ending. How would such look like?
At last - this fixed my issue too. Many thanks
Thank you so much for mentioning this! I was pulling my hair out trying to figure out why my code wasn't working.
Maybe you could mention that the Serial Monitor should be set to "No Line Ending" otherwise you will get an extra line/0 each time. Took me a while to figure that one out.:-)
got me too, then i made the change👍
Yes! Thank you, I literally just spent half an hour changing all sorts of code and trying to troubleshoot why I thought my While loop wasn't working properly.
This drove me nuts. Thank you so much.
Thanks for that comment. Saved me some thinking ! Lol
Huge thanks. I was hoping someone mentioned this in the comments, and it only cost me 2 minutes, not 2 hours of frustration.
The real reason for RUclips to begin with , is having a channel like this ! One of the best teachers I’ve ever seen
ضيخون
I almost gave up on Arduino programming, then I came across this channel. Thank you sir !
it's hard sometimes to explain to my family why I'm yelling at my computer screen
Same with me
You, young lad, just read my fookin mind.
lol
1 minute of silence for who doesn't get the joke
😂😆
Watched videos up to this point, and it made me always wait for the "NOOOOO" as intentional mistake/blunder and the "BOOM" as eureka :) Good thing the sketch compiler only takes a few seconds to compile short codes, I don't want Paul to hold his breath long :)
I'm a professional programmer and an electronics-hobbyist, and I'm having a great time learning through these videos on how to finally see my codes work on the physical world via arduino (and through these lessons). Thank you Paul McWhorter! I will be completing all your lessons here.
Some syntaxes have changed in 4 years like the "string", but still these lectures are truly gold. Thanks a lot sir.
Paul, you are a very special person, teaching HS is not easy, and with your engineering knowledge you could make tons of money in the private sector, yet you chose to help these HS students get started in engineering. I hope they appreciate what you are giving them. Thank you very much, my God bless you greatly
You're the first person who is actually able to teach this subject in a way that I can understand. Thank you very much for the content, I find myself writing and saving all the sketches you are teaching us and leaving comments on them as reminders where I went wrong so that when I refer back to them it helps fault find. I've made it to lesson 18 and I'm hooked!
Same XD
I absolutely enjoy your teaching method :) "Hold your breath", "Boom","Noo!". It really makes learning a lot fun, especially for a subject like this. I am so much thankful!
purple_hat 54 yep, I hold my breath every time I compile, and I guess I get that “boom” moment every time it compiles without error, 🤣🤣it
the is funny
Yes I like that too. I have learned so much from Pauls video's, Ha video's! now I'm showing my age 😄
Paul, you are one of the best teachers I've ever had, it's a pleasure to listen to your lectures, thank you so much.
You are very welcome
I like putting in a fake processing loop with a message like "Processing...beep-beep-bop-boop..." just to give the little projects a little more life to them. I love this series so much and can't wait to start adding more sensors into our circuits!
Me: Already doing Pinmode.
Paul: Not doing it.
Me: Thinking have i outsmarted Paul. :)
At the end you were right!
Just a tip for other viewers:
I had an issue where serial monitor would ask how many blinks, I would enter, and it would work properly. But when it void looped, it would double prompt me with "How many blinks do you want?".
The issue was my fault - you need to change the serial monitor from "Newline" to "No line ending" in the drop down menu next to baud rate, in the lower right-hand corner. This is something that Paul suggested many tutorials ago, but I didn't change until now. This guy knows his stuff so pay attention =)
when i did change it to "no line ending" my code stopped working!!!! :D
I like the idea of the user getting the chance to add data they get to interact with the system instead of just watching. Thanks Paul.
Mr McWhorter....just want to say, I am a farmer and a truck driver, but Ive always been kind of an amateur scientist & engineer. I havent had much formal education, but Ive been educating myself in many subjects for many years because its just what I love to do. Besides, a farmer has to wear many hats. Anyway, I want to thank you for doing what you do. Its a tremendous benefit to people like me :)
The Arduino & Raspberry technologies have enormous potential in agricultural applications, and I hope to soon be putting them to use as much as possible
Farmer's and truckers are part of the backbone of America.
I know we are still just starting out but now it is getting interesting and useful. Your tutorials are very well done. Thank you.
thanks for teaching sir!!🙏 .Also now i got two habbit of holding breath before compiling and saying boom after code success!☺️
Everytime Paul mentions the coffee, rumble or blue and green led for special occasions he really makes my day I wish I had a teacher like Paul in school
I love your quote : See the power. This gives us power to get our wishes into Arduino. Not this but also that : I am in control of my destiny. It is up to me how many times I wanna blinks the led. You are not just a great teacher but you are great philosopher also. Your explanation, code writing style and teaching style are so different from the other. God bless you. Thank you.
Well said!
@@paulmcwhorterThank you.
Paul you are a great teacher...i wish i had a teacher like you in my high school.Your way of teaching is superb..keep going.
You're awesome Paul! Learning a lot from you. Don't pay attention to these hateful messages, it's their fault they can't debug their own code.
Thanks for these videos!!!
I literally have never seen a hate comment on this channel
I'm 52 years old and I'm learning a lot with your videos, they're easy to understand and I can already do some circuits. Please continue with the lessons. Thanks
Paul has a natural way of teaching in a fun and easy way to understand even complicated materials. Thank you Paul.
My pleasure!
Love the way you teach in your magnificent videos. Always a pleasure when a teacher really show the “traps” in programming and focus on the important basic skills. A bunch of thumbs up to you.
great video love the "pause the video and see if you can do this" tasks and the home work you put out really help to get the brain cells working please keep those coming
Excellent vid, I started learning computers 55 years ago but had to drop it, now am right back into it , Paul is a big part of my comeback thank you
Cheers
Robin from Australia
I had a semi colon ; at the end of my for loop and it caused it to only blink once. Took me half hour to figure it out. but once i removed it, the code ran fine. Loving these videos. The second coffee spill made me laugh out loud for real. You are such a great teacher Paul, I am enjoying every lesson.
Mr. McWhorter, I just want to say thank you so much for these lessons. Not only am I having a blast learning something new, but you are brightening up a pretty dark time (i.e. social distancing, pandemic, etc). You make us laugh while you teach us programming, troubleshooting, and your love of ice coffee. :-)
i am in 6th grade now and during this summer other than plying video games all day I'm listing to u
thx man
Start playing with my Uno board now. Came back and did all the programs from the beginning of the series.
My son will love this. I have a BSEE from Berkeley. I love how you break this embedded programming into very accessible demo lectures.
Love it Paul,
Nguyen Le
Excellent!
please grandpa and I am 13 years watching you from Ghana I don't understand something from lesson 18, you said we are going to read from the serial monitor give me much insight on that and the the other serial commands could you explain more on them for me please, but all together thanks for what you are teaching it has really inspired me to be someone like you one of the greatest engineers in the world and i am pursuing that by starting with arduino. Thanks grandpa paul
Another educative lesson from the great teacher. great work.
Thank you so much Paul. I am new to arduino and this series is really helping me out.
I had figured out that j=j+2 should be j=j+1 and was shouting at you to notice it( absolutely love it when you put in mistakes for us to debug).
I just have to say, I saw you type j+2 and I couldn't wait... it was WORTH IT. Knocking over coffee (twice), knocking over the mic, the LED wasn't bright enough, you would say "three...." and nothing would happen, I was dying 😂😂😂😂 I knew you'd figure it out obviously but that was some of the best TV watchin' I've done in a while 😂😂
For what it's worth, obviously, these kinds of mistakes are amazing and sooo glad you leave them in, because I deal with them on a daily basis just trying to learn this stuff too haha.
(btw, I specifically sought out how to parse data on your channel, I knew I would learn and also be entertained )
Love your channel and the Arduino tutorial, I am new to this topic and found this to be just the best out there. Thanks for the great tutorial and time.
Pandemic brought me here, thanks sir Paul. You're far greater than my University Professors.
I decide to study Arduino just to kill time during my summer break. And this is the perfect place
Aside from forgetting my semicolon a couple of times I was successful with this tutorial. Another big thanks for all that you do.
I’m going to date myself and share that I learned Fortran using the punch card reader in college. We gave our stack to the student assistant and waited for the errors and ridicule to come back on a print out. Writing code for the Arduino is so much better. You can spot the errors without the ridicule . These lessons are fun to do. Thanks for doing them.
Hello Mr. Paul
I'm an applied informatics student and I can't wait for the more advanced tutorials
Had tears in my eyes from laughing. I love this man!
Paul this tutorial was just the best. I love your easy going nature and the way you impart your knowledge. Thanks again for such an insightful lesson. 😀
Glad it was helpful!
Idk how but your videos might be the funniest and most educational contents on youtube.
I caught the mistakes as soon as you purposely made them Paul!!! Trucking right along! Hope to be caught up soon! Keep on keepin on!
I was ready to rumble... :(
Another fantastic tutorial, Paul. Please don't take any notice from the doubters on here. Your lessons are great, mate! Thumbs up from the Old Limey here in England.
He is one of the most experienced engineer as well as professional teacher who i have ever seen in any Electronic classes.
I am very grateful.
I was waiting for this!!!
You kinda had an Austin Powers moment there at the 10min mark :) lol love your videos!
Your doing a great job by not giving us all the answers that's the mark of a good teacher. You get nothing for free in life and working for it makes it stick in the old cranium better,Thanks Paul.
Paul there will always be people that want the answers handed to them and I get it they get frustrated and need to feel like they are moving forward we all do but I think there are way way more of us who like discovering things for ourselves after gaining a working knowledge we adapt and learn. I stand by what I said before your doing a great job and I for one appreciate it as I am sure many others do to so keep it up and don't worry to much about naa sayers this world is made of many types of people and there are more of us than them.
This lesson was harder for me to follow... Nice that I can watch it as many times as it takes. Thanks!
This was a fun one (actually, they are all fun!) A bit more explanation on the Serial.available() command could be useful here, for example would I ever use it for anything other than this case of waiting on the user to enter a value. Also I'm curious if there is a way to have a user enter two or more unique inputs during the run. Maybe that is covered in subsequent lessons? Way to go on coding through the impediment of spilled coffee - handled like a pro! The important thing is it did NOT hit the Arduino! :D
You can do 2 or more inputs before anything happens. One example is using another subsequent While to wait for the 2nd input. I'm starting out on this coding stuff so can't suggest anything fancier.
the numbers off blinks i could not seem to work out but in the code if you change this line
for(j=0; j
I am a retired elderly missionary surgeon from Australia, who has been recently introduced to Arduino. Learning to code is an entirely new experience, which I am enjoying . I am now up to lesson 20, but find I need to go back over the previous lessons to check my coding. It would be most helpful to be able to go to a particular lesson, perhaps at its conclusion, and view a single page of the complete code, rather than scroll through the lesson to find a particular entry.
I join many others to commend your lessons, both technical and biblical.
Thanks for these videos, Paul! My Arduino kit sat in a closet for a year because the kids lost interest pretty quickly since they haven't learned to program yet and didn't have a great resource to get started. I just just found your videos and speeding through them. I'll definitely now get them started from the beginning. They are perfectly paced for them to learn the programming at the same time. Keep up the great work.
Love the cringe on compile. You are the Bob Ross of Arduino ("Beat the devil out of it!").
truest comment ever.
"And we got a happy little orange color"
Question: Why is if I input 9 ones 111111111 serial monitor shows a value of 27591?Just curious
maybe it is too large, overflow the capacity of arduino to handle a limited value of integer
U gotta put a double instead of an int
Hi you are employing 16 bit integer in the declaration.
2^16 = 65536.
so when you input a number larger than 65535 it overflows and starts filling the register with the remaining value.
Here, when you enter 111,111,111 its starts filling the register but it overflows, so it starts filling the register again but since your number is very large it repeats the process over and over again. 1495 times actually. After repeating it 1495 times it has a remainder of 27591. And thats the value it shows.
111,111,111 / 65536 = 1495.42100525
0.42100525 * 65536 = 27591 !!!!
@@prabhakaranbaskar1400 Any extra bits go into the bit bucket.
Hi Paul, Thank You for Your hint with "No Line Ending", otherwise I would have spent my youth looking for a mistake. I'm still with you every lesson, slowly trying to make small adjustments. It's still holding me and drawing me in more and more...
I tried two LEDs (red and yellow) with two inputs asking how many times I want to blink the red LED, then the same with the yellow LED.
Turns out you can store your inputs, then you can use separate "for loop"s for each LED e.g blinks for red LED then 9 blinks for yellow LED.
I was VERY happy to see it working.
Thanks Paul!
Why did the LEDs work at all (albeit dimly) before you initialised the pin?
According to the Arduino reference; the internal pull-up resistor is enabled by default when pins are undeclared, and the resistor acts to limit the available current. Unfortunately the Atmega328 datasheet offers only basic schematic diagrams of the I/O pins so I'm unable to explain exactly how this happens.
Source : www.arduino.cc/reference/en/language/functions/digital-io/digitalwrite/
@@danthemancasey Thanks for that explanation. Appreciate it.
Now I never use the blue LED... XD "it is for special occasions" haha
Paul: Your tutorials are great! Even a thick headed ole guy like me can understand them. Keep up the good work.
this one was a gaffe a minute, has me in tears
when i wrote the code, it waits for me to enter my number, and displays the number i entered... it then tells me my number is 0 and asks for my number again
Hi Pepsi,
I had this same issue! After digging I found that in the Serial Monitor, you likely have it set to "new line" but should set it to "no line ending." This worked for me and should for you too if your code is written exactly like Paul's.
Happy coding!
Good day,
I am getting the send number(77) plus an other line with a zero. how can I stop this.
Your number is: 77
Your number is: 0
Thank you
Make sure serial monitor is set to no line ending.
@@paulmcwhorter Thank you
Thanks. I had the same problem ... Now it is fixed :-)
I've been following along since the start here and this is where it really gets interesting and fun for me. If only all teachers could adopt your teaching style Paul. Looking forward to heading on to the future lessons. PS - When I write the code on my own now I subconsciously hold my breath.😂The golden rule, besides the ice coffee. Cheers !
Paul,
I am Peter from Belgium. I just retired. I can now focus on my hobbies. one of them is 3D printing! I have several projects that I want to combine with Arduino. Arduino is totally new to me. I had already bought a tutorial kit with accompanying book for beginners. It soon became unclear to me.
Now with your way of teaching things are going much better so far. I understand the commands much better and all commands so far have all been successful. I also take notes with my own words to better understand everything. I know that there are now more than 60 lessons. You explain it all in great detail. Arduino and programming language is totally new to me, but at least at your pace I can follow it.
The goal is to make my 3D projects work with external 12V or 24V power supplies. I think there's a lesson to be learned from this. But first through all the other wonderful lessons.
Keep it up Paul!
This is the best Arduino learning series there is, PERIOD! Don’t take any shortcuts or you’ll pay the price later or even give up on Arduino.
I played with this a bit and made it ask me two questions, gallons of gas and miles driven, and then calculate the miles per gallon. It was a fun exercise!
I thought the ear pinching was going well to begin with, then I changed ear.
This has been a massive lesson, and it looked like you might have been struggling with allergies yet you still made it. Thank you.
I had to stop the video several times. I was missing the closed bracket at the end. This is what I like so much is you (Paul) letting me figure it out sometimes. That's the way I learn! It's there and I missed it lol. Great video!
This video just helped me starting the Bluetooth module communication with android phone , thank you. Guys, keep in mind, that Arduino pins 0 and 1 , are the same ones as USB port. So for downloading a program Bluetooth should be disconnected from arduino board. And Computer should be disconnected from Arduino in order to start Bluetooth
Hi Paul. Thanks for the videos! They are very educational and do not let any hate speech stop you from doing these videos. You are much appreciated all the way from South Africa!
Your so called ramble adds to the fun in the learning, I have past the age to be come an engineer but that's not stopping me from the learning, apart from that you are getting me through these lockdowns with interest plus the pleasure of learning such an array of program uses.
I get flustered at times simply because I can’t keep up with the typing and absorbing what I’m typing ...then I remember to pause, rewind and start over, sometimes several times but I finally get it. I realize that people who can keep up aren’t being held back. Said it before but I’ll say it again, sure wish this feature was available when I took my trade courses many years ago. Also, really learning the importance of entering the code correctly, 🤨 Hate it when your code works and I’m stuck for a while de-bugging. Seems like a lot to take in and if I were to comment, I need more assignments to do on my own to make sure I am getting it put in the grey matter, in large part because mine is extra grey. Thanks again Paul.
Wally Murray if Paul doesn't give homework on a lesson, then play around with the code and circuit so you will learn more about how it works or doesn't work. Hope you are learning from the debugging and remembering. Mine is grey too and not remembering so easily, even though most of this is a review for me.
Hello professor Paul, this class was very good, I managed to do everything that was presented, pausing the video and making an effort to try to achieve it.
I always hold my breath, I find it very funny, just like the numbers in the loop, hehe.
Thank you for sharing this class with us.
Excellent!
For anyone confused about the new version for Arduino not having a separate Window for the serial monitor they don't separate them anymore. Also after you put in your number instead of just hitting enter it makes you hit Ctrl and enter. Said it in the right there in the box and it took me 30 minutes to figure it out. Time for a brake to wake up.
Really enjoying your tutorials. Old timer here. I have been in electronics and field service for years. Programing always seemed like it was too much to explore. Your videos really opened up this part of electronics for me and you present it quite well. Please keep’em coming. I found your fusion 360 and 3D printing very interesting as well. Which I could have a student in your class when I was in school!
Paul thanks for everything you have done so far. I appreciate your enthusiasm to teach something new in every episode. Greetings from Turkey.
I love how passionate he is about what he is doing. I would have loved it to have him as a teacher. Thanks Paul
Every time he spills his coffee we are reminded of how excited this guy is
This man is just getting cooler and cooler.
BOOM!! one of the best teachers I've ever had , Thank you for sharing your knowledge with us, you will never be forgotten ! Your student from Tunisia.
Mr.Paul i just want to say thank you for all that you are doing on this channel may god bless you.I am 14 years old and just desided to become an engineer and you are the most perfect teacher i could ever ask for.The way you explain the steps make me more interested in engineering thank you so much.
Hello dear Paul McWhorter.
I'm from Hungary and I"m student of electrical engineering and I write my thesis with arduino, so your tutrial videos are a huge help for me. I just would like to say thank you so much and sorry for my bad English :)
Please give us homework/projects to help us retain this information. I have a great grasp on your teachings while I work with you, but when I try to use it later, I am drawing blanks. The lessons with homework just seem to stick better.
Thank you for taking the time to post these videos!
You are the best Paul. Fortunately most people are appreciative, but perhaps some don't realize you don't have to do this for a living - you do it because helping people is a noble endeavor. Regardless, people walk different paths that come here and life can be stressful and frustrating. If you fall into that category, just learn to be resourceful and persistent, and you will be rewarded.
I did catch those errors and was yelling at you (while still trying to hold my breath to, no avail), kids thought I was losing it...lol
Tried pausing before the blinking section to figure out the coding, first instinct was the for loop but tried with while and got no where, played a few more seconds until I confirmed my for statement hypothesis re-paused and wrote it out with no further complications, barring the comma semi-colon debacle I also encountered at first. Lessons are surely paying off, Thank You.
A great lesson! Took me a while to understand the code, but it was great. Thank you very much for teaching us how to do debugging. I was so confused when LED barely blinked.
Congratulations old man. I think I have your age and I appreciate a lot your CLEAR explanations in your PERFECT spelling. I am not native English speaKER and I appreciate your diction.
PERFECT: some younger TEACHERS SHOULD LEARN FROM YOU!
I find your tutorials to be very easy to follow and are well paced. You are also entertaining keeping the subject matter light. Thanks.
You are just awesome, When I get done with arduino I will continue whatch your videos to learn something else and have fun at the same time, thank you for your series
Loving this course still. It brings insight on OOP principals of C++ within the Arduino environment. Your explanations to the logic is very precise and memorable. Thank you for being so amazingly unique. It honestly helps recall the information later, in the field. C++
My students love the way you teach!!! I do to. God is with you for Shure.
Your videos are great and all. And I like your videos. I wish I discovered them EARLIER, but I really wished I suggested you to get in the habit of disconnecting the power and then editing it.
But the tutorials are AWESOME!
Videos are just the right length. I really like the way you teach because it makes easier to remember what things to check over and over so the code would compile the first time I try it. I caught the "j=j+2" immediately while you were coding the example. However, I did not catch that you did not write the "pinMode" command, because my program compiled the first time. I keep making mental notes that if I need to use the pins, then I have to set it up first and then use it, so "pinMode" and "digitalWrite" or "analogWrite" commands always go together, no matter what. Thank you again for your time and dedication you put in these tutorials.
BOOM ! works a treat. Given the 'most excellent' knowledge you've imparted thus far Paul, I embellished the output a little with adding the 'user input' value & mm to the output string...ie "For a radius of 9.00 mm, The Area is : 254.34 mm // perfect … "
I'm a high school student stuck in quarantine over the summer break so I thought this would be one of the saddest summer breaks I've had. I got my arduino kit in the mail a few days ago and I realized all I need to get through this is your videos and my arduino. Thanks for the awesome vids!
So happy to read this. Please, go through all the lessons, then think about moving to the Artificial Intelligence on the Jetson Nano series. Lot of good stuff here for you to learn