This is not intended to be a full explanation of Arduino, but rather an address of some misconceptions of what Arduino is and what it’s supposed to be. I am by no means an expert and I use an Elegoo Uno (which is an Arduino knockoff), because I am a cheap sore loser.
Arduino is intended to be an accessible, ready-to-use microcontroller kit for prototyping. For cost reasons, the designers decided to use an Atmel AVR/ATmega8/168/328(p).
Now that we know this, let’s get into the misconceptions.
“Arduino is Arduino”
Meaning that Arduino is its own thing and you can’t use anything to replace it. No. Arduino is simply a PCB containing:
- the microcontroller you want to use
- an accessible way to get to the pins supported by the microcontroller
- an external clock crystal you can swap out
- a couple of fuses so you don’t burn your toy out from playing with the leads
- a USB controller for easy programming (which actually might turn out to be more powerful than your target microcontroller)
- USB/12V ports
- Firmware that facilitates easy programming for the target microcontroller
You could rig your own programmer for your target microcontroller, solder everything yourself, but you’re missing the point. It’s for convenience. Any manufacturer can make “Arduino”-like kits and they’d work great anyway.
Arduino IDE is the only way to program the Arduino
Wrong again. This is actually the most rampant misconception out there. Actually, Arduino IDE is a horrible “IDE” if you can even call it that. It is quite literally a Java application with the Processing user interface (because Arduino was taken from Wiring, which in turn was based off Processing). When you compile something, it just executes a preprocessing script that takes your code and slaps on some standard headers, then it invokes the prepackaged gcc that actually does the heavy lifting. When you upload something, it invokes avrdude with the COM port you chose in the context menu and wow, magic!
If you want, you can make your own Makefile or CMake configuration that invokes all of this. I actually recommend this choice, because then you are free to use any text editor of your choice.
Arduino uses its own programming language
“Wow it has classes, it must be Java!” “Hmm, it could be Processing.” Nope, it’s C++. The only thing it doesn’t have are exceptions, and that’s just because the AVR wasn’t designed with any exception handling capabilities at all. So, every time you read an “Arduino Programming Language” tutorial, you’re actually being deceived into writing ugly C++ code. Take a small breath, and realize you’ve been passing your big objects by value instead of by address all along. Use pointers.
ATmega328 is like any other processor, but smaller
Except it’s not. It’s an 8-bit RISC processor with a tiny instruction set with somewhere around 16 MHz of clock speed, which is marginally better than the clock speed on a Zilog Z80. Even with a very powerful language at your disposal, you still have to optimize code.
Anyway, I’m tired and I’m out of ideas for what to write next.