Top Related Projects
Arduino core for the ESP32
Your Gateway to Embedded Software Development Excellence :alien:
STM32 core support for Arduino
CircuitPython - a Python implementation for teaching coding with microcontrollers
MicroPython - a lean and efficient Python implementation for microcontrollers and constrained systems
Quick Overview
Arduino is an open-source electronics platform based on easy-to-use hardware and software. It's designed for anyone making interactive projects, from hobbyists to professionals. The Arduino IDE and language provide a simple and accessible way to program microcontrollers and create various electronic projects.
Pros
- Easy to learn and use, making it ideal for beginners
- Large and active community, providing extensive support and resources
- Cross-platform compatibility (Windows, macOS, Linux)
- Wide range of compatible boards and shields for diverse projects
Cons
- Limited processing power compared to more advanced microcontrollers
- Not suitable for complex, high-performance applications
- Can be more expensive than bare microcontrollers for large-scale projects
- Some users find the Arduino IDE too basic for advanced development
Code Examples
- Blinking an LED:
const int ledPin = 13;
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(1000);
}
This code blinks an LED connected to pin 13 on and off every second.
- Reading an analog sensor:
const int sensorPin = A0;
void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
delay(100);
}
This code reads an analog sensor connected to pin A0 and prints the value to the serial monitor every 100 milliseconds.
- Controlling a servo motor:
#include <Servo.h>
Servo myServo;
const int servoPin = 9;
void setup() {
myServo.attach(servoPin);
}
void loop() {
myServo.write(0);
delay(1000);
myServo.write(180);
delay(1000);
}
This code controls a servo motor connected to pin 9, moving it between 0 and 180 degrees every second.
Getting Started
- Download and install the Arduino IDE from the official website.
- Connect your Arduino board to your computer using a USB cable.
- Open the Arduino IDE and select your board type and port from the Tools menu.
- Write your code or open an example sketch.
- Click the "Upload" button to compile and upload the code to your Arduino board.
For more detailed instructions and tutorials, visit the official Arduino website or refer to the extensive community resources available online.
Competitor Comparisons
Arduino core for the ESP32
Pros of arduino-esp32
- Specifically optimized for ESP32 microcontrollers, offering better performance and feature support
- Includes built-in Wi-Fi and Bluetooth functionality
- Provides access to ESP32-specific features like touch sensors and deep sleep modes
Cons of arduino-esp32
- Limited to ESP32 boards, reducing hardware flexibility compared to Arduino
- May have a steeper learning curve for users familiar with standard Arduino
- Potentially less stable due to more frequent updates and changes
Code Comparison
Arduino (Blink example):
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
arduino-esp32 (Wi-Fi scan example):
#include <WiFi.h>
void setup() {
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.disconnect();
}
void loop() {
int n = WiFi.scanNetworks();
Serial.println("Scan done");
if (n == 0) {
Serial.println("No networks found");
} else {
Serial.print(n);
Serial.println(" networks found");
}
delay(5000);
}
Your Gateway to Embedded Software Development Excellence :alien:
Pros of PlatformIO Core
- Multi-platform support: Works with various boards and frameworks beyond Arduino
- Dependency management: Built-in library manager and package handling
- Command-line interface: Enables automation and integration with other tools
Cons of PlatformIO Core
- Steeper learning curve: More complex setup and configuration
- Less beginner-friendly: Requires more technical knowledge
- Smaller community: Fewer resources and tutorials available
Code Comparison
Arduino:
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
PlatformIO:
[env:uno]
platform = atmelavr
board = uno
framework = arduino
[env:esp32]
platform = espressif32
board = esp32dev
framework = arduino
The Arduino example shows a simple sketch, while the PlatformIO example demonstrates a project configuration file supporting multiple boards. PlatformIO's approach allows for easier management of multi-board projects and dependencies.
STM32 core support for Arduino
Pros of Arduino_Core_STM32
- Supports a wide range of STM32 microcontrollers, offering more hardware options
- Provides access to advanced features specific to STM32 chips
- Optimized for STM32 performance, potentially resulting in faster code execution
Cons of Arduino_Core_STM32
- Smaller community and fewer resources compared to the main Arduino platform
- May require additional knowledge of STM32 specifics for advanced usage
- Limited compatibility with some Arduino libraries and shields
Code Comparison
Arduino:
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
Arduino_Core_STM32:
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalToggle(LED_BUILTIN);
delay(1000);
}
The Arduino_Core_STM32 example uses the digitalToggle()
function, which is specific to STM32 and more efficient for toggling pins. This demonstrates how Arduino_Core_STM32 can leverage STM32-specific features while maintaining Arduino-like simplicity.
CircuitPython - a Python implementation for teaching coding with microcontrollers
Pros of CircuitPython
- Easier for beginners with Python-based syntax
- Supports live code editing and REPL for faster development
- Better suited for rapid prototyping and education
Cons of CircuitPython
- Limited to specific microcontrollers, mainly Adafruit boards
- Slower execution speed compared to compiled C++ code
- Smaller ecosystem and community support
Code Comparison
Arduino (C++):
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
CircuitPython:
import board
import digitalio
import time
led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
while True:
led.value = True
time.sleep(1)
led.value = False
time.sleep(1)
The CircuitPython code is more readable and intuitive for beginners, while the Arduino code is more compact and efficient. CircuitPython's use of high-level abstractions (e.g., board.LED
) simplifies hardware interaction, whereas Arduino requires explicit pin management. Both examples achieve the same result of blinking an LED, showcasing the different approaches of each platform.
MicroPython - a lean and efficient Python implementation for microcontrollers and constrained systems
Pros of MicroPython
- Uses Python, a high-level language that's easier to learn and read
- Supports interactive REPL for quick testing and development
- More memory-efficient for complex applications
Cons of MicroPython
- Slower execution speed compared to compiled C++ code
- Limited hardware support compared to Arduino's extensive ecosystem
- Larger firmware size, which may not fit on some microcontrollers
Code Comparison
Arduino (C++):
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
MicroPython:
from machine import Pin
import time
led = Pin(25, Pin.OUT)
while True:
led.on()
time.sleep(1)
led.off()
time.sleep(1)
Both examples blink an LED, but MicroPython's code is more concise and readable. Arduino's setup() and loop() structure is replaced with a simple while loop in MicroPython. The Pin and time modules in MicroPython provide similar functionality to Arduino's pinMode() and delay() functions.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Arduino is an open-source physical computing platform based on a simple I/O board and a development environment that implements the Processing/Wiring language. Arduino can be used to develop stand-alone interactive objects or can be connected to software on your computer (e.g. Flash, Processing and MaxMSP). The boards can be assembled by hand or purchased preassembled; the open-source IDE can be downloaded for free at https://arduino.cc
More info at
Bug reports and technical discussions
-
To report a bug in the software or to request a simple enhancement go to Github Issues
-
More complex requests and technical discussion should go on the Arduino Developers mailing list
-
If you're interested in modifying or extending the Arduino software, we strongly suggest discussing your ideas on the Developers mailing list before starting to work on them. That way you can coordinate with the Arduino Team and others, giving your work a higher chance of being integrated into the official release
Security
If you think you found a vulnerability or other security-related bug in this project, please read our security policy and report the bug to our Security Team ð¡ï¸ Thank you!
e-mail contact: security@arduino.cc
Installation
Detailed instructions for installation in popular operating systems can be found at:
- Linux (see also the Arduino playground)
- macOS
- Windows
Contents of this repository
This repository contains just the code for the Arduino IDE itself. Originally, it also contained the AVR and SAM Arduino core and libraries (i.e. the code that is compiled as part of a sketch and runs on the actual Arduino device), but those have been moved into their own repositories. They are still automatically downloaded as part of the build process and included in built releases, though.
The repositories for these extra parts can be found here:
-
Non-core specific Libraries are listed under: https://github.com/arduino-libraries/ (and also a few other places, see
build/build.xml
). -
The AVR core can be found at: https://github.com/arduino/ArduinoCore-avr
-
Other cores are not included by default but installed through the board manager. Their repositories can also be found under https://github.com/arduino/.
Building and testing
Instructions for building the IDE and running unit tests can be found on the wiki:
- https://github.com/arduino/Arduino/wiki/Building-Arduino
- https://github.com/arduino/Arduino/wiki/Testing-Arduino
Credits
Arduino is an open source project, supported by many.
The Arduino team is composed of Massimo Banzi, David Cuartielles, Tom Igoe and David A. Mellis.
Arduino uses GNU avr-gcc toolchain, GCC ARM Embedded toolchain, avr-libc, avrdude, bossac, openOCD and code from Processing and Wiring.
Icon and about image designed by ToDo
Top Related Projects
Arduino core for the ESP32
Your Gateway to Embedded Software Development Excellence :alien:
STM32 core support for Arduino
CircuitPython - a Python implementation for teaching coding with microcontrollers
MicroPython - a lean and efficient Python implementation for microcontrollers and constrained systems
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot