Can I program my Arduino using any programming language other than C++? If so, which programming languages? What software would I need for compiling and loading my code onto the Arduino?
1Related: arduino.stackexchange.com/questions/105/…– The Guy with The HatFeb 13, 2014 at 2:53
Unfortunately, this is an effective duplicate of an non-Arduino.SE question: see here I think the question I linked should be moved here after beta ends, but not just yet.– apnortonFeb 13, 2014 at 2:58
@anorton That question is asking about alternative IDEs. This question is not a duplicate because it talks about alternative programming languages.– tstewFeb 13, 2014 at 3:02
@user2202326 Sorry... I seemed to recall more people responding with different languages than IDEs on that thread, but, apparently, I was wrong. Carry on.– apnortonFeb 13, 2014 at 3:04
You could look into Netduino if you are familiar with C# (Visual Studio is the way to go, but there are other ways to compile C# code). I don't know what board you have and if it is compatible though. netduino.com– Jason DownFeb 13, 2014 at 16:39
Some commonly known ones:
In theory you should be able to extend avr-gcc to support other languages, though this is no small undertaking. I should also caveat that support for languages other than C typically comes with some fairly weighty restrictions on language components -- for instance, even with C++ it's discouraged to be instantiating new objects as
free are extremely expensive in both memory space and cycles.
Besides using Google, the following references are applicable Click Here.
In theory, any compiler which outputs AVR assembly could be used (modulo limitations on code size, ram usage etc).
AVR backends exist for both LLVM and GCC -- so in theory, with some effort, most languages which are supported by LLVM and GCC's front-ends could be compiled to AVR. A big question will be library support, etc.
Never the less, here's a couple of odd choices for the spirit of the question, rather than its letter .
- AMForth, a forth dialect can be flashed onto an Arduino.
- AVR-Ada: Ada for AVR micro-controllers.
- BASIC: Bring back the Goto!
Oh, and you could write raw AVR Assembly!
- I Haven't tried these though!
I'm surprised that nobody has mentioned AVR Assembly!
Assembly is not often thought to be the most interesting, or even an easy method of programming, but it's nonetheless, 100% possible with all AVR based arduino. SAM boards will likely not work with this flavor, but it's still possible to use assembly in their programming.
All Arduino boards (as of posting) support assembly programming via Atmel Studio, The SDK made for Atmel based chips.
Assembly is naitively supported by all Atmel devices, and requires no boot loader in order to work, so all programs are inherently real-time.
2Note that assembly is also supported by the gcc toolchain, which is included in the Arduino IDE install. Jun 13, 2019 at 16:45
@EdgarBonet Correct, which is why the
__asm__("Assembly code here")works to add in-line assembly to any sketch. For most programs, this is a bad idea, however, as it's difficult to achieve platform independence with this method.– tuskiomiJun 13, 2019 at 16:54
Because avr-g++ should support all standard C / C++ constructs it is possible to code inline assembly. More info on this arduino.cc forum thread
Inline assembly isn't part of the C/C++ standards, but gcc and the microsoft c compiler support it, although incompatibly.– tbodtFeb 17, 2014 at 1:02
true, and so do the avr_gcc. Feb 18, 2014 at 12:34
Nothing beats writing executable code in hex anyway. Jun 10, 2017 at 11:32