Question

How can i use "Plain C" to program Arduino without using the "Processing programming language"? I want to improve my C programming skills by using it with Arduino for embedded systems.

I have very limited ability to code in C++, and I would love to write my own Arduino Library using "C", to avoid using classes and OOP.

Processing looks like Java to me, and i want to use "C pointers" to gain more practical knowledge.

Était-ce utile?

La solution

The thing is that Arduino doesn't use Processing.

Processing is (was?) a separate programming language which was developed independently for a different purpose. The language resembles C and C++ very closely, so closely that it's almost identical.

Programming the Arduino, however, is accomplished using a (n unfortunate) mixture of C and C++, with a set of custom libraries (which are similar in style to that of Processing). These libraries are written in C and C++ themselves, and they are only good for making one's code more portable across different MCU types. Using them is not strictly necessary for programming the AVR MCU. In fact, the libraries have quite a few drawbacks (the code is big, inherently slow and ugly, amongst others).

If you want to use plain ol' C for programming the Arduino, then just go ahead and do so. Grab the reference PDF from Atmel's site for your particular MCU, learn the special registers (I/O, timers, etc.), install the avr-gcc toolchain on your computer, and use avr-gcc, avr-objcopy and avrdude to compile and install your programs.

There also happens to be a C-only library which follows this kind of convention. It doesn't provide as much abstraction as the stock Arduino library has, because it's lower-level, but you can have a look at it and see how one can accomplish basic algorithms without the default libraries.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top