arduino / arduino/reference-en
The Arduino programming language is not fully documented
- Dominant language
- No language data
- Stars
- 173
- Forks
- 704
- PR merge metrics
- No merged PRs in 30d
Description
The Arduino Language Reference is the only official documentation of the Arduino programming language, but it is far from complete.
Some examples of important things that are not mentioned in the the Arduino Language Reference:
- C string functions
- Default arguments
- Overloaded functions
- `enum`
- Templates
- Classes
How can users be expected to learn these parts of the Arduino programming language from the current documentation?
In my own learning journey with Arduino I started writing sketches using the Arduino Language Reference as a guide and quickly reached a point where I said to myself "Is that all there is to the Arduino programming language? I need more." I was about to give up on Arduino and move on to a more capable microcontroller platform when I stumbled across a post on the Arduino Forum that made me realize that there was so much more to the Arduino programming language, but I would need to use a C++ programming reference to discover it.
Once I realized this, I knew Arduino was the right choice. So it worked out OK for me, but this is far from an ideal learning path. How many other users in my situation would never chance upon that forum post? I know I'm not the only one who has had this sort of experience because it comes up regularly on the forum.
---
I can see two possible solutions:
### Document the differences between the Arduino programming language and C++
Create a new page on arduino.cc that explains what the Arduino programming language is:
- A brief history (Processing, Wiring).
- A description of the sketch preprocessing processes that make the Arduino programming language different from C++:
- Concatenate .ino files, starting with the file that matches the folder, followed by the rest in alphabetical order. Save the resulting file with a .cpp file extension.
- Add `#include ` if not already present.
- Add function prototypes for any functions that don't already have one.
- A link to an external C++ language reference (e.g., http://www.cplusplus.com, https://en.cppreference.com)
- Add a link to the new page from the description at the top of the Arduino Language Reference home page.
This means the Arduino Language Reference only needs to document the Arduino core API and some basics to get beginners started, which it already does a good job of.
**Advantages:**
- Easy to implement and maintain. Others are responsible for the huge task of completely documenting the language.
- Makes it easy for the user to understand how to apply their Arduino programming language knowledge to writing C++ as well (e.g., writing Arduino libraries).
**Disadvantages:**
- The external C++ reference will contain information that is not applicable to Arduino. The reader will need to have some intuitive filter for which parts of that documentation are useful and which can be ignored.
### Fully document the Arduino programming Language in the Arduino Language Reference
**Advantages:**
- We can custom tailor the documentation for Arduino.
- We may be able to write the documentation so that it is easier to understand for the target audience than the external C++ documentation.
**Disadvantages:**
- A huge amount of work to implement and maintain.
- Has the potential to make the Arduino Language Reference less friendly to beginners. I think we would need to have some way of separating the advanced topics that beginners should not be immediately exposed to from the rest.
### Related
- https://github.com/arduino/reference-en/issues/519 / https://github.com/arduino/reference-en/pull/684
- https://github.com/arduino/reference-en/issues/522
- https://github.com/arduino/reference-en/issues/709
- https://github.com/arduino/reference-en/issues/725
- https://github.com/arduino/reference-en/pull/778
- https://github.com/arduino/reference-en/issues/794
- https://github.com/arduino/reference-en/issues/799
- https://github.com/arduino/reference-en/issues/989
- https://github.com/arduino/Arduino/issues/11682
- https://forum.arduino.cc/t/no-documentation-on-ternary-operators-on-language-ref-page-et-al/87004/8
- https://forum.arduino.cc/t/does-the-bracket-matter/599746/4
- https://forum.arduino.cc/t/how-to-turn-an-integer-into-a-string/612305/3
- https://forum.arduino.cc/t/language-question/633964
- https://forum.arduino.cc/t/c-types/672762
- https://forum.arduino.cc/t/unusual-language-construct/697008
- https://forum.arduino.cc/t/difficulties-with-included-c-files/698153
- https://forum.arduino.cc/t/undefined-reference-to-tone-after-including-arduino-h/698830
- https://forum.arduino.cc/t/meaning-of-void-doesnt-return-a-value/960173/35
- https://forum.arduino.cc/t/documentation-on-additional-functions/1030122
- https://forum.arduino.cc/t/complete-reference-for-arduino-programming-language/1112176
- https://forum.arduino.cc/t/decent-documentation/1299627
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the Arduino Language Reference home page and the proposed arduino.cc page describing Arduino and its differences from C++. Review the linked related issues and pull requests before choosing whether to document the C++ topics directly or explain the preprocessing and link to an external reference. Done should mean that the selected scope is documented and linked from the reference home page.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- arduino, cpp
- Domain
- documentation, embedded-iot
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100