I know that this question is general, but I couldn’t find a tutorial or a good coding way to convert Arduino code (I mean the code that we are writing on Arduino software and it doesn’t matter for Arduino Uno or Mega or … ) even if a small sample.
Is there a tutorial?
I just want to learn the technique, and I know that it depends on the project.
Arduino code is, more or less, C code.
The unique things that happen with Arduino is that the code is preprocessed (for example, they give simple hooks by establishing the
setupandloopfunctions) and has a managed build/upload process that takes care of board limits, includes, libraries, etc…It is certainly possible to use the same toolkit yourself to build and run the code, that’s how I do it. Arduino and GCC, compiling and uploading programs using only makefiles is the most useful link I’ve found covering the steps you need to get started.
As I said, I’ve left the Arduino IDE and taken up the
avr-gccroute myself, because if you know the GNU tools, you can do much more powerful things – like use the C++ standard libraries. I missed myvectors, what can I say. avr-libc is lagging quite a bit when it comes to full C++ functionality, making it hard to cram in the STL, but Andy Brown has gotten much of it working.Throw those things together and you have quite a powerful development environment.