Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programming Languages Targeting Arduino/AVR

What programming languages or environments target Arduino or AVR besides the default C++ environment?
PS: I'm using Mac OS 10.5.

like image 655
None Avatar asked Jul 05 '11 23:07

None


People also ask

Which programming language should I use for Arduino?

The language used is based on C and C++, there are a couple of small differences designed to make Arduinos as easy to use as possible. The Arduino IDE will do some pre-processing to the code to avoid some unwanted errors but other than that it's C and C++.

What programming language is AVR?

The most widely used high-level language for AVR microcontrollers is C, so this document will focus on C programming. To ensure compatibility with most AVR C compilers, the code examples in this document are written using ANSI C coding standard.

Can you use other languages with Arduino?

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++.


2 Answers

Some commonly known ones:

  • Ada
  • Basic, alt, alt
  • Forth, alt, alt
  • Java
  • Pascal
  • Python
  • C (mac) and C (Windows)

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 malloc and free are extremely expensive in both memory space and cycles.

Besides using Google, the following references are applicable:

  • http://www.piclist.com/techref/atmel/avr/languages.htm
like image 130
Mark Elliot Avatar answered Sep 21 '22 18:09

Mark Elliot


An incredibly popular option is to program your Arduino directly in C, versus Wiring (the programming language used by the Arduino IDE). This allows a lot more control over the low-level operation of your microcontroller.

The Arduino IDE supports C (as Wiring is based on C and C++) and compiles with the AVR-GCC toolchain, or you can go without an environment and use a text editor, the command line (with AVR-GCC toolchain installed) and avrdude (a command-line tool available on MAC, Windows and Linux).

AVR devices can also be easily programmed with Atmel Studio (formerly AVR Studio), which can use a multitude of programming languages.

The Arduino forums have a lot of information for programming in C.

Information regarding the AVR-GCC toolchain can be found here.
http://www.nongnu.org/avr-libc/

I personally quite enjoyed taking the hard way around and learning how to program an AVR chip without the IDE, but this comes down to personal preference and how much you want to learn.

like image 31
Daniel Avatar answered Sep 20 '22 18:09

Daniel