Is it possible to program an Arduino with other languages that aren't C/C++ based? What would be required to do so? I know that other IDE's are available, I'm curious about actual programming languages, like being able to code the Arduino in Python, as an example.
-
\$\begingroup\$ I've edited the question to clarify that I'm talking about languages, not the IDE. \$\endgroup\$– nathangiesbrechtApr 9, 2013 at 21:28
-
2\$\begingroup\$ If C# is your thing, check out the Netduino. \$\endgroup\$– Kevin MarkApr 9, 2013 at 21:30
-
1\$\begingroup\$ @KevinMark There is the slight issue that he might not be able to use a Netduino (needs the added ports of a Mega, for example). \$\endgroup\$– PolarApr 9, 2013 at 22:21
-
\$\begingroup\$ @Polar I believe the Netduino Go has additional connectivity options. \$\endgroup\$– Kevin MarkApr 9, 2013 at 22:38
-
1\$\begingroup\$ @powtac String is Arduino specific? I wonder why I have so many in my code then... \$\endgroup\$– PolarApr 10, 2013 at 12:44
2 Answers
It's definitely possible to use alternate languages for development with Arduino, just not necessarily using the standard IDE. This is as, at the end of the day, the C/C++ code is assembled into byte-code for the AT-chip on the Arduino board. One language you could use is Céu, a higher-level version of C/C++. The main issue that you'll have is finding a compiler for your language of choice - at the end of the day, you could write your own - however, this requires an intimate jnowledge of C/C++ anyways. Therefore, it is probably best to stick to C/C++, at least for the time being.
EDIT: You've slightly rephrased your question, so yes, it would be possible to program your Arduino in Python (poor choice of language, though that's just my opinion), but you would need a different IDE / a custom compiler for the reasons above. Also, you would have to be careful when linking libraries written in a different language for the Arduino (as they're all C/C++).
-
\$\begingroup\$ It really is not possible to run python on the arduino (except the Arduino Mega, anyways). The python-on-a-chip project is working on a compact python runtime, and it needs at least ~8KB of SRAM. \$\endgroup\$ Apr 9, 2013 at 22:17
-
1\$\begingroup\$ Python is really, really not suited for small, memory-constrained environments. \$\endgroup\$ Apr 9, 2013 at 22:18
-
2\$\begingroup\$ @ConnorWolf Two points: 1) My use of Python as an example was as it was in the question - I dislike Python anyways. 2) Theoretically, you could convert the Python into C and then you would avoid the need for a Python runtime on top of the bootloader. \$\endgroup\$– PolarApr 9, 2013 at 22:19
It looks like there currently isn't any way to easily code an Arduino in anything but Assembly/C/C++ (and Céu as mentioned in Polar's answer -- though this is just translated into C++). There are many languages from which you can communicate with the arduino, though.
However, in theory it is not impossible. You just need to write a compiler for the chip and define the built-in functions, and then transmit the compiled code via the serial port. Or you can write a python-to-c++ translator and get that to work.
If you have a penchant for .NET, you may want to check out the Netduino. There seems to be a Java runtime environment for the AVR as well, called the NanoVM. There's also dk-basic for BASIC. I've not tried any of these, though.