Pragmatic C++ Arduino Programming
If you find that you are dedicating too much time on C++ programming and experience it as a hard, grueling task, you may want to consider a practical C++ programming approach as presented in this Arduino programming book.
Arduino C++ is based on the C++ programming language. C++ is a powerful professional grade programming language developed for mission critical applications. Under its deceptive simplicity lie powerful mechanisms, a trap for the newbie C++ programmer. C++ for dummies is a misnomer as it takes work and smarts to achieve effective C++ programming.
There are
good reasons for using Arduino and C programming enhanced by C++ programming. Arduino is the most ubiquitous microcontroller available and efficient C++ enables writing the smallest and fastest possible code for it..
- There are good reasons for using Arduino and C++ instead of another microcontroller and Python or other programming language.
- Concentrate on what one needs to master – i.e., what we, Arduino programmers, need to know concerning C++, and what we can avoid spending time on yet should be aware of.
- Don't just know C++, understand it! Many of C++'s unique features (parameter passing, pointer arithmetic, referencing, ...) are explained; extensive code examples clarify concepts.
- C++ being deceptively simple, discover the many gotchas it can throw at you.
- Memory management – know how memory gets used and monitor it: avoid stack overflows and out of memory conditions. Understand what may corrupt memory and anticipate its use.
- Discover C++'s preprocessor, a unique extremely practical feature practically no other language has. Use it way beyond simple #defines. A dedicated chapter covers the preprocessor, its syntax, how to use its macro mechanism, and how to avoid its many gotchas.
- Save RAM by storing read-only variables in flash memory via the PROGMEM framework. Store read-only float values and the contents of read only struct and class data. Do's and don'ts are presented with concrete examples.
- Use operator overloading to simplify programming and improve the application's robustness. The overloaded new operator enables memory management; the overloaded index operator [], used within the context of a SafeArray class, prevents under or overshooting array boundaries.
- Handle errors with setjmp/longjmp, an alternative to the unsupported C++ exception handling.
- Psychological factors which influence productivity are covered. One's mental condition, good vs. bad habits, understanding Maslow's pyramid hierarchy of needs, are keys to productivity.
- The companion book, Defensive C++ Arduino programming, introduces AtmelStudio and Visual Studio 2022 plus Visual Micro to develop Arduino applications with. It also introduces Awk, Perl, regular expressions and proposes frameworks to quick start your application.
- Download free open-source licensed frameworks source code and Awk, Perl, an regular expression tidbits from the books' Web site: https://md-dsl.fr.
Being pragmatic means doing whatever it takes to obtain results: adhere to good programming practices, hone your C++ skills, understand how psychological factors influence the quality of your work.