How Classes and Objects Work in Arduino Programs - Ultimate Guide to the Arduino #20

Поділитися
Вставка
  • Опубліковано 19 кві 2023
  • Classes let you re-use the same function on multiple objects, which eliminates the need to have multiple copies of the same code in a program. This makes your code much simpler and far more efficient. In this video we learn how classes and objects work in Arduino programs and how to write your own classes to simplify your code!
    This is tutorial #20 in the Ultimate Guide to the Arduino, a complete video course on the Arduino microcontroller with 45 lessons that are designed to teach anyone how to master the Arduino at any skill level. Visit our UA-cam channel page to watch the entire series!
    Get the 3-in-1 Arduino Smart Car and IOT Learning Kit from SunFounder here:
    www.sunfounder.com/products/s...
    Or get the kit from Amazon:
    US Amazon: amzn.to/3W1Mahh
    DE Amazon: amzn.to/3j0oETn
    JP Amazon: amzn.to/3UYrHZG
    UK Amazon: amzn.to/3uTJZAC
    CA Amazon: amzn.to/3W2vExN
    Get an Arduino Uno from SunFounder here:
    www.sunfounder.com/products/a...
    Visit the webpage for this video tutorial on Circuit Basics for wiring diagrams and example code:
    www.circuitbasics.com/program...
    And be sure to check out the Circuit Basics blog and social media for more articles and tutorials on the Raspberry Pi, Arduino and other DIY electronic projects!
    www.circuitbasics.com
    Facebook: / circuitbasic
    Twitter: / circuitbasics
    Instagram: / circuitbasics
  • Наука та технологія

КОМЕНТАРІ • 16

  • @darrelldougherty8215
    @darrelldougherty8215 3 години тому

    Most excellent tutorial on writing classes and how to use objects. Thank you kindly.

  • @vegansynths7757
    @vegansynths7757 Рік тому +5

    I’ve read write ups and watched many videos on classes but this is by far the clearest explanation I’ve seen. Thank you so very very much. 😊

  • @madhukeshnp
    @madhukeshnp Рік тому +1

    Slow and steady tutorial. Very easy to follow up. Well explained. Well done. Waiting for more tutorials like this.

    • @Circuitbasics
      @Circuitbasics  Рік тому +1

      Here's a link to the playlist for the whole course: ua-cam.com/play/PLW4FQTHYB40QKQBempqODlsZ2NrKIgdyQ.html

  • @andymouse
    @andymouse Рік тому

    Great stuff, I have learnt a lot ....cheers.

  • @tech1706
    @tech1706 7 місяців тому

    Best explanation so far

  • @DIYRobotGirl
    @DIYRobotGirl 8 місяців тому

    Does writing classes and objects like this still use the same or more bytes during upload? Does the class and objects like this help with multi tasking? Is it similar to using outside python script with excel for data or even act as the same as a library or an example in arduino. Meaning it shortens the amount of bytes used?

  • @billfield8300
    @billfield8300 11 місяців тому +1

    Thanks for the great tutorial. The information was very concise and exactly what I was looking for. I took notes and everything. Saved to my 'watch later' folder for reference. Thanks again.

  • @jkRatbird
    @jkRatbird 4 місяці тому

    Great explanation, but for me it would have been so much easier to follow if you named the class “BlinkingLed” or something else that makes sense!

  • @manfredbogner9799
    @manfredbogner9799 2 місяці тому

    Sehr gut

  • @billferner6741
    @billferner6741 Місяць тому

    Did I just miss an explanation why using Class and Object? It is very workintensive and restricts development on only this machine.

  • @paulalmquist5683
    @paulalmquist5683 5 місяців тому +2

    Good explanation of the structure needed to create and use a class but your use of the term "rate" is misleading. What you call "rate" is the delay time, ie, the on time and off time of the LEDs. "Rate" (more specifically a temporal rate) is something per unit of time, like flashes per second or miles per hour. In a practical application it may be easier to express the rate as so many flashes per second with a flash duration of some number of milliseconds or a percentage of the cycle time. This complicates the code so in your setting one may easily lose sight of the basic structure to use and get over involved in the application so a simple example is appropriate. I taught programming for many years and found it important to choose variable and function names with care to reflect what is actually happening in an example compared to the formal structure.
    Most of my programming was in the pre-object oriented era and am now trying to learn this new to me methodology. While watching your video I created a formal structure for the code using terms like "className" and "functionName" and in parallel wrote the blinker example using "Blinker" for the class name and blinkLED for the function name. "MyClass" in the example is meaningless to the purpose of the example. I have not yet seen great benefit of classes and objects compared to the vintage concepts of subroutines and functions I used while programming in Fortran decades ago. There may be more benefit in very large projects than the size of the ones I worked on. I have been dabbling with microcontrollers for a relatively short time so much to learn, so little time.

  • @jimmacino8712
    @jimmacino8712 5 місяців тому +5

    The 'background noise/music/beat box. is VERY irritating, and UNNECESSARY! Good material, drop the disco!!!