@zander Yeh, that's entirely possible. OO really kicks in when you have an increasingly large team. The most efficient code will always be produced by a top-flight programmer working in C/Assembly Language.
I edit my posts to fix typos, correct grammar, or improve clarity. On-screen keyboards are evil.
@zander Ok, let me know.
I edit my posts to fix typos, correct grammar, or improve clarity. On-screen keyboards are evil.
@binaryrhyme I got it now by taking it in 2 pieces. Compiled clean in IDE 1.8.19
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
@binaryrhyme Assembler was a high level language to somebody who was working in machine code. I had a lot of assembler macros and my assembler code towards the end of that era looked almost like a high level language.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
@zander The upside of C++ is,
Don't forget the added benefit of portability. That is, being able to use the same OOP object (library) by simply including it in the next project.
The internal functionality remains constant, you just need to write your app/sketch/module to set it up to accommodate your current needs.
Anything seems possible when you don't know what you're talking about.
@will Not sure that's unique to C++
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
I just said it was a benefit, it applies to all OOP languages.
C++ on the Arduino is seldom used except in libraries where you create independent objects and to a very mild extent in the main sketch (where you override the setup and loop methods.
Anything seems possible when you don't know what you're talking about.
@will And non OOP as well.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
But if you're using a procedural language to simulate packaging code and data together, you'll likely have a problem with variable names colliding between packages. It's also much more difficult to override methods.
Anything seems possible when you don't know what you're talking about.
@zander I taught a course on how to use C for telephony in the 80s, and a mandatory part of the course was was the -s assembly dump, with an attendant analysis of how efficient the code was and how it might be improved. When you have thousands of users, and microseconds matter... well, you want to squeeze cycles - especially when your CPU is a Motorola 68000 😉
I edit my posts to fix typos, correct grammar, or improve clarity. On-screen keyboards are evil.
@will Overrides and inheritance are hard, but you can use a struct with data members and pointers to functions to implement a simple class where the functions are bound to the data, if the first parameter of every function is the struct you are processing.
I edit my posts to fix typos, correct grammar, or improve clarity. On-screen keyboards are evil.
@will That's not what I thought we were talking about. I thought it was portability as in a new hdw/os/lang could use the code.
No idea why variable names would collide, they cease to exist for all practical purpose at the machine code level that a library is in.
Never overrode a method in my life, so no comment.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
@will Overrides and inheritance are hard
My point was that OOP eliminates a lot of that clutter and permits easier access to classes for programmers.
I mean, really, unless you're writing a library, almost everything you do on the Arduino is just C code anyway. Why do people want/need to bother with C++ (again, unless they're writing a library) ?
Anything seems possible when you don't know what you're talking about.
@will Well, that is why I am going to introduce increasingly complex examples not solved easily or clearly that DO simplify with OO techniques. I don't think OO is a panacea and I'm just as happy to write purely procedural code where it makes sense (about 80% of my Excel macros, lol) but that other 20% (e.g. Bill of Materials recursive tree walkers) are much easier using OO.
I'm going to continue to expand my examples - and will probably kick up a git library (I respond to feedback, lol) that will manage display updates, sensor readings, user input and computational time slices, all of which encapsulate specific tasks into discrete, easily managed objects. The overall context has a learning curve, but in the interests of adding overall clarity and the simplification of individual objects.
(But first I need to finish my bench power supply, lol)
I edit my posts to fix typos, correct grammar, or improve clarity. On-screen keyboards are evil.