Tech Note 117 - Creating an Arduino IDE Library (Part 1 of 4)

Поделиться
HTML-код
  • Опубликовано: 5 окт 2024
  • In this Part-I I go through how to create an Arduino IDE.
    Parts-II, III and IV are supplementary parts that expand on the detail.
    Code example: github.com/G6E...
  • НаукаНаука

Комментарии • 42

  • @TheGremlinsParadise
    @TheGremlinsParadise 4 года назад +2

    OMG THANK YOU SOOOO MUCH !!!
    I have 10s of videos explaining this and never got it.
    Bless you for actually writing the code and explaining it at the same time, instead of having a bunch of code prepared and then just show it. Also the way you are explaining it, detailed and in a slow speed. Many thanks for your great tutorials !

  • @deangreenhough3479
    @deangreenhough3479 5 лет назад +2

    Brilliant, this has demystified so many things for me. Full of really useful information, I wish this video had been about when I became fascinated in arduino and electronics 18 months ago. Like many hobbyist/makers you tend to learn what you need for the problem you are trying to solve. I have found part 1 to be a clear and concise tutorial. After this I feel compelled to start writing my own libraries. Thank you for the confidence boost and the education.

  • @Cptnbond
    @Cptnbond 3 года назад +2

    Nice tutorial, just a minor comments, the file is "Arduino.h", not "arduino.h", which breaks the code if run on an operating systems which recognize that these are really two different files, although Windows is "skimpy" on that.

  • @rjpeterson1
    @rjpeterson1 6 месяцев назад

    Dave you must have been a teacher! Your videos are so informative

  • @petebevan
    @petebevan 4 года назад +2

    Hi, thanks for your work in posting this video. It has opened up a new area of programming to me and developed my knowledge and skills no end.

  • @quaternion-pi
    @quaternion-pi 5 лет назад +1

    Excellent, clear discussion of a topic I find challenging. Thanks.

  • @santorcuato
    @santorcuato 5 лет назад +1

    As usual, clear and useful. See you on next chapters...

  • @wouladjecabrelwen1006
    @wouladjecabrelwen1006 3 года назад +1

    This teacher is amazing

  • @deangreenhough3479
    @deangreenhough3479 5 лет назад +1

    Well, well how much do I need and want to learn this? A huge amount😁😁😁 looking forward to the series. Thank you so much 🙏🏴󠁧󠁢󠁥󠁮󠁧󠁿

  • @npi8555
    @npi8555 5 лет назад +5

    Thank you for producing this content, it is very informative.
    I do have a question about the code:
    In the cpp file on line 3 you entered int dalay and on line 6 delay.
    The compiler didn't produce an error, is this because "delay" is already part of the Arduino libraries.
    I haven't had time to watch the rest yet but look forward to watching them.

    • @G6EJD
      @G6EJD  5 лет назад

      NPI yes the delay function is a standard Arduino core function

    • @G6EJD
      @G6EJD  5 лет назад +1

      Sorry, well spotted, you have just found a compiler error! that 'dalay' is ok as a parameter name, but later on 'delay' should have been queried by the complier as an undefined variable error, but did not! I'll report it.

    • @G6EJD
      @G6EJD  5 лет назад

      I've updated the github example to correct this. Actually I should have followed the convention rules and have placed an _ underscore in front of the variables, then the error would have been found! Thanks again.

    • @WereReallyRelayCamping
      @WereReallyRelayCamping 4 года назад

      i was waiting for the compiler error and instead it just carried on and i'm like what the hell! was told years ago never create a variable or routine that's similar in name to anything built in......for just this reason ...

  • @keldsor
    @keldsor 3 года назад +1

    I'm new to this Arduino programming - that's why I watch your nice videos :-) !
    I've been programming OOP in my younger life (now I'm retired) and when you talk about 'conventions' about '_' as prefix for properties I remember something about 'protecting' the properties by having methods to SET and GET each property.
    I know it gives much more coding and maybe thats why you drop it.
    I just want to know because I'm new to this Arduino.

    • @G6EJD
      @G6EJD  3 года назад

      I think you should use whatever you find best there are many conventions for example variable names like ‘nameVariable’ or ‘name_variable’ or ‘NameVariable’ or ‘_nameVariable’ and so on. It’s readability that’s important. For libraries it’s a generic convention that prefixing g with a _ is least likely to be confused by variables in the main code largely because few ever start a variable with _

    • @keldsor
      @keldsor 3 года назад

      @@G6EJD Ha, ha, I was more refering to the DIRECT manipulation of the properties - you DON'T recommend having methods for SET and GET the variables, IF these methods were to be coded, yeah, a lot more coding has to be done ... and I think it too will 'eat up' of the sparse memory ... so maybe it's wise NOT to code these methods.

    • @G6EJD
      @G6EJD  3 года назад +1

      Well it’s better to spend more time deciding what type of variable your using and define so you don’t waste memory so don’t use a 16-bit type when an 8-bit would do or even better use enumerated types there are few instances when you need to use numeric variables, especially on the ESP range of compilers that set the int type as 32-bit

  • @eriklaken1025
    @eriklaken1025 5 лет назад +2

    Thank you for all four, i Will learn them.:)

  • @t_sixtyfivex_wing8787
    @t_sixtyfivex_wing8787 5 лет назад +1

    Thank you very much for your kindness sir.

  • @liamorourke9685
    @liamorourke9685 2 года назад +1

    this has really helped me. thank you very much :)

  • @bob-ny6kn
    @bob-ny6kn 2 года назад +2

    How did your code run with "dalay"? What else did you edit without showing?

  • @mksmurff
    @mksmurff 5 лет назад +1

    Enjoying these videos thank you

  • @davebeckham5429
    @davebeckham5429 5 лет назад +1

    Excellent. Thanks.

  • @DocMicha
    @DocMicha 5 лет назад +2

    nice video even if you made a spelling mistake (Daley) but thanks to viedo editing magic you found it off camera ;-).

    • @G6EJD
      @G6EJD  5 лет назад

      The perils of recording a video in real time brings mistakes, yes delay was spelt incorrectly but what’s interesting is the compiler did not find that mistake, it should have. Thanks.

    • @DocMicha
      @DocMicha 5 лет назад

      @@G6EJD Strange, but I have another question. In many libraries even from adafruit they use not the scope resolution operator :: . but they work fine, also the convention of _variable is not used. Why and has it to to with C and C++ differences?

    • @G6EJD
      @G6EJD  5 лет назад +1

      It depends on the 'scope' some libraries are not libraries per-se more what might be termed 'includes' to save copying in large amounts of code. The scope resolution operator has to be used for the compiler to correctly make the associations with the library variables and functions. The underscore prefix is not necessary, it's just a CPP convention and most libraries do indeed use that convention, it's a personal choice of the library creator I suppose. It certainly helps to differentiate different variable types or names, often when they are named the same for convenience and readability.

  • @hashanmadusanka6128
    @hashanmadusanka6128 2 года назад +1

    I get error is LED_Controls.h: No such file or directory

  • @ara197
    @ara197 3 года назад +1

    Thanks for a very nice session on creating arduino libraries. I followed the same, and after completing I got some error, in the main program. Inside the void loop() function I have an error. It says LED1 and LED2, was not declared in this scope. Kindly suggest what might the issue. Thank you.

    • @G6EJD
      @G6EJD  3 года назад +1

      Did you include the library?

    • @ara197
      @ara197 3 года назад

      @@G6EJD , yes I did. Generally we tend to get this error if the instantiated objects are declared within the setup, but it is declared as global variables as you did, am not clear as to why it gives this scope error, even when (LED1, LED2) I made it global.

    • @G6EJD
      @G6EJD  3 года назад

      @@ara197 did you include extern
      extern int my_global_int;

    • @ara197
      @ara197 3 года назад

      @@G6EJD , No. I will include it. I did not ,since it wasn't there in your tutorial. But I will check and update you
      Thank you David

    • @G6EJD
      @G6EJD  3 года назад +1

      The compiler has been updated since I did the video

  • @u-bloxi-parry4042
    @u-bloxi-parry4042 4 года назад +1

    CAN you please help me get a way of putting my arduino_secrets.h tab to the library folder please so I can just call it like that please?

    • @G6EJD
      @G6EJD  4 года назад

      U-Blox, I-Parry, I would say secrets are not really suited to being a library but if you follow what I’ve done here everything should convert - but what are you trying to achieve - objects you can refer to, your own functions or what?