Arduino isn't exactly pure C++, though itβs very much based on C++ and shares many of its features. The Arduino programming environment uses a simplified version of C++ that is designed to be beginner-friendly. It also includes some custom libraries and functions that make it easier to interact with hardware, which isn't strictly part of standard C++.
Here's how it breaks down:
- C++-like Syntax: The basic syntax you write for an Arduino sketch (what the code is called) is very similar to C++ and often uses many of the same concepts, like variables, loops, conditionals, and functions.
- Arduino Functions: Arduino has built-in functions like
digitalWrite()
, analogRead()
, and delay()
, which are part of the Arduino core libraries. These are not standard C++ but are provided to make interacting with the hardware easier.
- Simplified Setup: The Arduino environment automatically handles some of the setup for you, like defining
setup()
and loop()
functions, which are specific to Arduino. These are not part of pure C++ but are a part of the Arduino framework.
- Object-Oriented Programming: Since Arduino is based on C++, you can use classes, objects, and other object-oriented programming features if you want to, but it's not a strict requirement for simple projects.
So, while Arduino is built on C++ and you can definitely use C++-style code, it's more of a simplified, hardware-focused version designed for quick prototyping and ease of use.