How to Organize Code

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 ธ.ค. 2024

ความคิดเห็น • 60

  • @RobWhittlestone
    @RobWhittlestone 2 ปีที่แล้ว +5

    NIce refresher for an old software engineer. Nice explanations. I haven't written code in over 20 years but have no problem staying with you. I cut my teeth on FORTRAN, ALGOL, FORTRAN 77, S-FORTRAN, Assembler from various machines, also embedded, Pascal, Turbo Pascal, ANSI 'C', COBOL, Visual Basic, JavaScript - and that's when I became a full time project manager. But it's important to know what the 'softies' are going through and what can go wrong. All the best, Rob in Switzerland

  • @planker
    @planker 2 ปีที่แล้ว +2

    Excellent. Lots to digest here. I have some printed sketches, I'll take a pencil to them and do some breakdown. Reverse engineering is how I've been doing this, nobody has thought me. You are doing Ok!

  • @sanamandingra
    @sanamandingra 7 หลายเดือนก่อน +1

    You just established my workflow forever... Thank you!

  • @jumadhaheri
    @jumadhaheri 2 ปีที่แล้ว +5

    Well prototype functions is something new to me, fantastic educational video, thank you

  • @HollyHertig
    @HollyHertig 11 หลายเดือนก่อน +1

    Thank you! You answered so many questions!

  • @KW-ei3pi
    @KW-ei3pi ปีที่แล้ว

    I always pick up something new, that may not be the main focus of the video. Like the side information on Function Prototypes. Thanks!

  • @mahmoodmohammad7241
    @mahmoodmohammad7241 2 ปีที่แล้ว +1

    Excellent, I like your way of teaching from scratch. Thanks

  • @mr.goldenrod291
    @mr.goldenrod291 2 ปีที่แล้ว +3

    Top of program, first comment is program purpose. Second comment(s) are the revision changes.
    I put my user-defined functions after loop() (and have not used prototyping.) Seems to make editing easier as I am paging up and down less. Otherwise, based on 30 years of programming, I organize my programs as you do.

  • @avejst
    @avejst 2 ปีที่แล้ว +3

    Great walkthrough of the process 👍
    Thanks for sharing your experience with all of us 👍😀

  • @ianbertenshaw4350
    @ianbertenshaw4350 2 ปีที่แล้ว +4

    Excellent video!
    This is one thing i think the Arduino IDE does wrong - by allowing a programmer to stick their user defined functions below the loop and secretly compensating for it is a bit misleading to newcomers. It wasn't until i used platform io which is more strict that i realised what was going on .
    Any plans to make some videos on MicroPython ?

    • @programmingelectronics
      @programmingelectronics  2 ปีที่แล้ว

      Thanks so much! Same for me, I really had no idea what was going on behind the scenes until I ran into an issue with not having a prototype written.
      Thanks for the MicroPython recommendation! No current plans but it’s something that’s has been interesting me for a while.

    • @pmanolak
      @pmanolak 2 ปีที่แล้ว +1

      IDE well allow users to put their functions at the end. Actually the sequence does not matter. we do the same in other languages too. p.e. PHP, JavaScript.

    • @programmingelectronics
      @programmingelectronics  2 ปีที่แล้ว +1

      You're right, in most cases the sequence doesn't matter as the IDE should be auto-generating those functions prototypes for you.

  • @tonymai124
    @tonymai124 2 ปีที่แล้ว +1

    I like your code font, would you tell the name of the font ?

    • @programmingelectronics
      @programmingelectronics  2 ปีที่แล้ว

      I think it is just the Arduino IDE default which i believe is called "Monoco"

  • @jon_raymond
    @jon_raymond 2 ปีที่แล้ว +9

    This was really helpful. Perhaps you might consider an episode about using different tabs to help organize code?

    • @programmingelectronics
      @programmingelectronics  2 ปีที่แล้ว +5

      Thanks so much, Jon! You must be reading minds because we just recorded a video on using tabs to help organize code, which will be released later this month. Thanks a ton for the suggestion; if you have any other video ideas, I would love to hear them!

    • @jumadhaheri
      @jumadhaheri 2 ปีที่แล้ว +1

      @@programmingelectronics yes please my currant WIFI clock is 3000 lines of code and any adjustment also a nightmare in Arduino IDE

    • @programmingelectronics
      @programmingelectronics  2 ปีที่แล้ว

      Thanks ​@@jumadhaheri !

  • @cursoderobotica
    @cursoderobotica 2 ปีที่แล้ว +2

    I love it!!! Cheers!!

  • @richardfurniss8091
    @richardfurniss8091 2 ปีที่แล้ว +3

    That explains a lot, Thanks

  • @jamescullins2709
    @jamescullins2709 ปีที่แล้ว

    Do you cover using other processors other than Arduino, like EPS32, STM ?

  • @h-h1859
    @h-h1859 2 ปีที่แล้ว +4

    Thanks for the video. Super helpful as always🙏❤️

  • @exequielwouterlood5481
    @exequielwouterlood5481 2 หลายเดือนก่อน +1

    Amazing tutorial!!

  • @warrenscorner
    @warrenscorner 2 ปีที่แล้ว +2

    Awesome video! What if my sketch gets so big it’s hard to find my functions? I created a sketch that the loop got so busy it was hard to figure it out so I created functions to break it up. Then I had so many functions that it was hard to find the function I wanted. How do I create my own libraries? Then how do I insert the code to jump to the library?

    • @jovialcupid9687
      @jovialcupid9687 2 ปีที่แล้ว +1

      U can make new tabs, no need for library

    • @programmingelectronics
      @programmingelectronics  2 ปีที่แล้ว +1

      We have a video coming out soon about adding tabs in the Arduino IDE to help organize code better - this is a different approach than creating a library, but I think still pretty helpful depending on the use case. If the functions are all related and share/act on similar data, then making a C++ class may be the way to go.

    • @programmingelectronics
      @programmingelectronics  2 ปีที่แล้ว

      Tabs are great! Thanks for adding this.

  • @DIYRobotGirl
    @DIYRobotGirl ปีที่แล้ว

    Isn't those neopixel legs need a 12v battery?

  • @RixtronixLAB
    @RixtronixLAB 2 ปีที่แล้ว +2

    Creative video, thanks for sharing it :)

  • @takatamiyagawa5688
    @takatamiyagawa5688 2 ปีที่แล้ว +2

    I was kind of expecting a guide on how to break up code into multiple .cpp and .h files, but I guess that just amounts to a rehash of the tutorial on the arduino site on writing your own library, and it's effectively C++.

    • @programmingelectronics
      @programmingelectronics  2 ปีที่แล้ว

      On a slightly similar vein (but definitely different), we do have a video coming out about using tabs in the Arduino IDE to help organize code. When you add a tab, it creates an additional .ino file in the sketchbook folder and can help with organization.

  • @0x8badbeef
    @0x8badbeef ปีที่แล้ว

    Arduino appears to be an exception to C. It surprised me I can put a function below where it is used, even without prototyping.

    • @programmingelectronics
      @programmingelectronics  ปีที่แล้ว

      The Arduino IDE has a build process that automatically creates prototypes for you (but sometimes it fails ;), which is why I usually always create prototypes for my functions. Thanks for the comment and for watching!
      arduino.github.io/arduino-cli/0.20/sketch-build-process/

  • @joshuapitong899
    @joshuapitong899 2 ปีที่แล้ว +1

    Thank you.😊🙌

  • @ZookeeperJohnG
    @ZookeeperJohnG 2 ปีที่แล้ว +1

    Super helpful!

  • @FioBrio
    @FioBrio 2 ปีที่แล้ว +7

    You should use Arduino IDE 2.0

    • @programmingelectronics
      @programmingelectronics  2 ปีที่แล้ว +1

      The Arduino IDE 2.0 is great! I love code completion, the movable serial monitor window, and moveable error console (among many other things). But, I am still having an issue with a lag in the serial monitor. When that gets worked out, I will probably make the switch.
      What I still like about Arduino IDE 1.0 is that it is really simple, which can be a huge advantage for beginners.

  • @kabandajamir9844
    @kabandajamir9844 2 ปีที่แล้ว +2

    So nice

  • @sandwon
    @sandwon 2 ปีที่แล้ว +1

    How do I install into my library? it is not in there.

    • @programmingelectronics
      @programmingelectronics  2 ปีที่แล้ว

      Great question! If you go to tools > library manager and then search for the FastLED library you can one click install it there.

    • @sandwon
      @sandwon 2 ปีที่แล้ว +1

      @@programmingelectronics Found it .Thanks

    • @programmingelectronics
      @programmingelectronics  2 ปีที่แล้ว

      @@sandwon Great! Glad that helped!