Arduino code is often written in a language that is a simplified version of C++ but with some unique features and abstractions provided by the Arduino environment.
Here's a detailed breakdown:
### 1. **Language Basis:**
- **C++ Foundation:** The Arduino programming language is based on C++. This means that it shares many features with C++, including control structures (like loops and conditionals), data types, and syntax. However, it simplifies some aspects to make it more accessible to beginners.
### 2. **Simplified Syntax:**
- **Arduino Sketch:** The code you write for Arduino is called a "sketch," and it typically includes two main functions: `setup()` and `loop()`. The `setup()` function runs once when the Arduino starts, and the `loop()` function runs repeatedly. This abstraction is specific to the Arduino environment and simplifies the programming process.
### 3. **Predefined Libraries:**
- **Arduino Libraries:** The Arduino IDE comes with a variety of libraries that abstract many complex tasks. For example, functions for interacting with hardware components (like LEDs or sensors) are often provided in these libraries. This helps users write code without having to handle low-level hardware details directly.
### 4. **Preprocessing:**
- **Arduino Preprocessor:** The Arduino IDE includes a preprocessor that converts Arduino sketches into standard C++ code. For example, it handles function declarations and includes necessary headers automatically. This pre-processing step simplifies the coding experience and makes it easier to get started.
### 5. **Object-Oriented Features:**
- **Limited Use of C++ Features:** While Arduino code is based on C++, it doesn’t always leverage the full range of C++ features, such as complex object-oriented programming. Basic classes and objects are used, but advanced C++ features might not be fully utilized in typical Arduino sketches.
### 6. **Community and Documentation:**
- **Arduino Community:** The Arduino community and documentation often refer to the language as "Arduino" rather than "C++," emphasizing its beginner-friendly nature and specific features.
In summary, Arduino code is written in a language based on C++ with some simplifications and specific features tailored for the Arduino platform. If you're familiar with C++, you’ll find that Arduino programming shares many similarities but is streamlined for ease of use in embedded systems.