Добавить
Уведомления

3 Ways to Comment Out Code In Arduino

🤩 Check out this Free Arduino Course 👇 https://bit.ly/get_Arduino_skills ***Get your Free Trial of Altium PCB design Software*** https://www.altium.com/yt/programmingelectronicsacademy Want to learn more? Check out our courses! https://bit.ly/3xwkOVm ***Get the code, transcript, challenges, etc for this lesson on our website*** https://bit.ly/3xqB8XK We designed this circuit board for beginners! Kit-On-A-Shield: https://amzn.to/3lfWClU SHOP OUR FAVORITE STUFF! (affiliate links) --------------------------------------------------- We use Rev Captions for our subtitles https://bit.ly/39trLeB Arduino UNO R3: Amazon: https://amzn.to/37eP4ra Newegg: https://bit.ly/3fahas8 Budget Arduino Kits: Amazon:https://amzn.to/3C0VqsH Newegg:https://bit.ly/3j4tISX Multimeter Options: Amazon: https://amzn.to/3rRo3E0 Newegg: https://bit.ly/3rJoekA Helping Hands: Amazon: https://amzn.to/3C8IYXZ Newegg: https://bit.ly/3fb03X1 Soldering Stations: Amazon: https://amzn.to/2VawmP4 Newegg: https://bit.ly/3BZ6oio AFFILIATES & REFERRALS --------------------------------------------------- ►Audible Plus Free trial: https://amzn.to/3j5IGrV ►Get LastPass: https://lastpass.wo8g.net/b3N1vk ►Join Honey- Save Money https://bit.ly/3xmj7rH ►Download Glasswire for Free:https://bit.ly/3iv1fql FOLLOW US ELSEWHERE --------------------------------------------------- Facebook: https://www.facebook.com/ProgrammingElectronicsAcademy/ Twitter: https://twitter.com/ProgElecAcademy Website: https://www.programmingelectronics.com/ Find a transcript to this episode and more: https://bit.ly/3xqB8XK Commenting out code. What does that mean exactly? Now, I'm not talking about commenting code. That's kind of a discussion in and of itself. I'm talking about commenting out code. That's when you kind of selectively turn off some of the code in your program. In this lesson, we're gonna cover three different ways to comment out code in your Arduino programs. They're all super easy, and you're gonna have them down pat, in no time. We'll also show you a super helpful keyboard shortcut that's gonna save you a ton of time, and a way to comment out multiple lines of code using just a single value. By the end of this lesson, you'll be equipped to comment out code in three different ways. Stay tuned. Subscribe to our YouTube channel to get more videos like this. So here we are in the Arduino IDE, and I've got a SketchUp, and all it's doing is walking through an array of pin numbers, and then it is turning on each of the LEDs attached to those pin numbers. I'm using a kit-on-a-shield to light up the LEDs. You can see it's just kind of going back and forth. And we're just gonna use this sketch to kind of demonstrate what it means to comment out different blocks of code. So let's do this. So let's say I've got a line of code in here that I don't want to be included in the program when it gets uploaded. Like I just want to temporarily turn off a line of code. What do I do? Well, I just put two forward slashes in front of the line. These two forward slashes are called a comment, and you'll notice all of the text, all the code after that line get grayed out. It kind of becomes this grayer color. And what this means is that this line of code is not gonna be verified when we verify it, or it's not gonna get included when we upload it either. So this is effectively a way to turn off a line of code. Now, you don't have to just use comments for commenting out code. You can do it to leave little notes to yourself, but this isn't about those notes. This is about specifically commenting out code and different ways to do it. Now, another way to do this exact same thing of typing forward slash, forward slash is to put your cursor where you want to comment out some code, go up to Edit, and then click Comment/Uncomment, and that'll do the same thing. I'll just undo that. Or you could select an entire code block and go up to Edit, Comment/Uncomment. But you know, having to use the CONTINUED... https://bit.ly/3xqB8XK ***About Us:*** This Arduino lesson was created by Programming Electronics Academy. We are an online education company who seeks to help people learn about electronics and programming through the ubiquitous Arduino development board. ***We have no affiliation whatsoever with Arduino LLC, other than we think they are cool.***

12+
16 просмотров
2 года назад
12+
16 просмотров
2 года назад

🤩 Check out this Free Arduino Course 👇 https://bit.ly/get_Arduino_skills ***Get your Free Trial of Altium PCB design Software*** https://www.altium.com/yt/programmingelectronicsacademy Want to learn more? Check out our courses! https://bit.ly/3xwkOVm ***Get the code, transcript, challenges, etc for this lesson on our website*** https://bit.ly/3xqB8XK We designed this circuit board for beginners! Kit-On-A-Shield: https://amzn.to/3lfWClU SHOP OUR FAVORITE STUFF! (affiliate links) --------------------------------------------------- We use Rev Captions for our subtitles https://bit.ly/39trLeB Arduino UNO R3: Amazon: https://amzn.to/37eP4ra Newegg: https://bit.ly/3fahas8 Budget Arduino Kits: Amazon:https://amzn.to/3C0VqsH Newegg:https://bit.ly/3j4tISX Multimeter Options: Amazon: https://amzn.to/3rRo3E0 Newegg: https://bit.ly/3rJoekA Helping Hands: Amazon: https://amzn.to/3C8IYXZ Newegg: https://bit.ly/3fb03X1 Soldering Stations: Amazon: https://amzn.to/2VawmP4 Newegg: https://bit.ly/3BZ6oio AFFILIATES & REFERRALS --------------------------------------------------- ►Audible Plus Free trial: https://amzn.to/3j5IGrV ►Get LastPass: https://lastpass.wo8g.net/b3N1vk ►Join Honey- Save Money https://bit.ly/3xmj7rH ►Download Glasswire for Free:https://bit.ly/3iv1fql FOLLOW US ELSEWHERE --------------------------------------------------- Facebook: https://www.facebook.com/ProgrammingElectronicsAcademy/ Twitter: https://twitter.com/ProgElecAcademy Website: https://www.programmingelectronics.com/ Find a transcript to this episode and more: https://bit.ly/3xqB8XK Commenting out code. What does that mean exactly? Now, I'm not talking about commenting code. That's kind of a discussion in and of itself. I'm talking about commenting out code. That's when you kind of selectively turn off some of the code in your program. In this lesson, we're gonna cover three different ways to comment out code in your Arduino programs. They're all super easy, and you're gonna have them down pat, in no time. We'll also show you a super helpful keyboard shortcut that's gonna save you a ton of time, and a way to comment out multiple lines of code using just a single value. By the end of this lesson, you'll be equipped to comment out code in three different ways. Stay tuned. Subscribe to our YouTube channel to get more videos like this. So here we are in the Arduino IDE, and I've got a SketchUp, and all it's doing is walking through an array of pin numbers, and then it is turning on each of the LEDs attached to those pin numbers. I'm using a kit-on-a-shield to light up the LEDs. You can see it's just kind of going back and forth. And we're just gonna use this sketch to kind of demonstrate what it means to comment out different blocks of code. So let's do this. So let's say I've got a line of code in here that I don't want to be included in the program when it gets uploaded. Like I just want to temporarily turn off a line of code. What do I do? Well, I just put two forward slashes in front of the line. These two forward slashes are called a comment, and you'll notice all of the text, all the code after that line get grayed out. It kind of becomes this grayer color. And what this means is that this line of code is not gonna be verified when we verify it, or it's not gonna get included when we upload it either. So this is effectively a way to turn off a line of code. Now, you don't have to just use comments for commenting out code. You can do it to leave little notes to yourself, but this isn't about those notes. This is about specifically commenting out code and different ways to do it. Now, another way to do this exact same thing of typing forward slash, forward slash is to put your cursor where you want to comment out some code, go up to Edit, and then click Comment/Uncomment, and that'll do the same thing. I'll just undo that. Or you could select an entire code block and go up to Edit, Comment/Uncomment. But you know, having to use the CONTINUED... https://bit.ly/3xqB8XK ***About Us:*** This Arduino lesson was created by Programming Electronics Academy. We are an online education company who seeks to help people learn about electronics and programming through the ubiquitous Arduino development board. ***We have no affiliation whatsoever with Arduino LLC, other than we think they are cool.***

, чтобы оставлять комментарии