Help converting C to arduino?

I currently have a couple of projects that use atmega8L chips that were programmed using your traditional C programming.

I’ve been toying with the idea of converting that over to set up an arduino to run the code and rebuild the hardware based entirely on the arduino format.

Is there anyone out there that can help me out with this? When it comes to code, I know almost nothing at all!

Arduino is C for many practical purposes. Rename the main() function in your existing program to setup() and add an empty loop() function, and you might be done.

More work will be required if you have functions whose names collide with arduino core functions, or have managed to step in one of the few pits where C++ is pickier than C. In any case, the above trivial modification is still the logical first step.

(You CAN convert some of your C code ideas to arduino core functions, but there isn’t a lot of reason to do so, unless you want to be portable across multiple majorly different Arduino-like hardware platforms.)

If you are using one of the old Arduinos that use an ATmega8 you could use another IDE such as AVR studio and upload the code using an AVR uploader program, I have a tutorial on the subject on my site [<LINK_TEXT text=“https://sites.google.com/site/qeewiki/b … r-software”>https://sites.google.com/site/qeewiki/books/avr-guide/getting-started-with-avr-software</LINK_TEXT>.

If your Arduino uses a ATmega168 or a ATmega328 you are going to have to rewrite a lot of the code because, the register setup has changed ie, most of the bits still exist but in different, registers refer to the ‘Register Summery Section’ of the datasheet.

Cheers

Q](https://sites.google.com/site/qeewiki/books/avr-guide/getting-started-with-avr-software)