Hey, it is possible to use C++ on an ATmega328p-pu(Commonly known as Arduino Uno).
Best regards.
The Arudino framework is written in C++ and is supposed to be used with C++. (The .ino
files are basically C++.) So clearly: Yes.
Is using the Arduino framework a good option for you?
Iām writing a Hardware Abstraction Layer from scratch, so I was wondering whether I could use some STL containers for that purpose.
Arduino is not really an option.
It seems that AVR supports C++ syntax and stuff, but seemingly not the STL, so I removed any STL includes, yeah raw pointers all the way
So if you already have an environment that supports C++, you can use one of many libraries designed for restricted devices like the ATmega328P that implement a subset of STL or STL-like features.
Have a look at:
- https://www.etlcpp.com/
- GitHub - mike-matera/ArduinoSTL: An STL and iostream implementation based on uClibc++ that supports my CS-11M class.
- GitHub - HalfBloodScot/Arduino-Containers: A collection of C++ containers for Arduino avr programming.
Even though two of them are designed for Arduino, they can likely be used in other environments with minor modifications.
Thanks for the references.
I think I will stay with raw pointers and arrays, I guess. Might be neat with containers, but might be less efficient.