Sign up ×
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It's 100% free, no registration required.

I am a beginner and I want to learn AVR C/CPP. Can I do this using an arduino? ( I'm asking this because I already have one). If so, could someone tell me using which IDE can I write code in pure C/CPP and then flash it to the atmega328 on the arduino? Or, should I get an AVR and a programmer instead?

I've searched all over the internet and I'm really confused by all the terminology. Could someone explain it to me?

share|improve this question
1  
So in order to program the 328 I believe you need to install atmel studio to compile your code and then use the command line command avrdude to put your compiled code onto the arduino. – Treesrule14 Sep 30 '14 at 14:34
    
@Treesrule14 that's a possibility, but not the only one, so it's untrue to say that it is necessary. If the Arduino IDE is installed, then so is the avr-gcc compiler on which it depends. – Chris Stratton Sep 30 '14 at 14:42
    
@Treesrule14 I have the atmel studio installed. I just cannot find any resources that might help me flash a program to the chip on the arduino using a bootloader (without a programmer). Is this even possible? – Azrael93 Sep 30 '14 at 15:00
    
I believe you need a programmer. : ( – Treesrule14 Sep 30 '14 at 15:39
2  
You don't need any IDE. You can compile and upload using the toolchain that comes with Arduino. Look at Arduino.mk for example. – hobbs Sep 30 '14 at 22:10

2 Answers 2

Yes, get an AVR programmer instead.

1) You can flash your arduino board with avrdude/avr-gcc. Install these tools, find the datasheet of atmega328 (google it), use the board pinouts to connect to your programmer (stk500v2/ISP) and voila!

2) Keep in mind that by "manually" flashing your atmaga on arduino board you're removing bootloader that is needed to load your sketches from ARDUINO IDE.

3) Use your favourite C/C++ IDE

share|improve this answer
1  
you should be able to find and reflash the bootloader for the arduino look here arduino.cc/en/Hacking/Bootloader?from=Tutorial.Bootloader – Treesrule14 Sep 30 '14 at 15:37
    
No! You do not need a programmer, or to remove the bootloader. The Arduino bootloader has zero dependence to the IDE or libraries - you are every bit as free to use it with stand alone C programs as with Arduino sketches. Doing it that way is not only cheaper, but lets you use the same board for both styles of development with no configuration changes. – Chris Stratton Oct 1 '14 at 14:44
    
The author wanted to learn AVR in pure C. He didn't ask - hey guys, how to play with arduino IDE or someth. but how to reuse the atmega on board he already has. – soerium Oct 1 '14 at 15:07
    
@ChrisStratton since you disagree with the other answers Submit an Answer please – Treesrule14 Oct 1 '14 at 18:42

If you're a beginner, I suggest you write C in the Arduino IDE. The libraries are very useful and I think the Arduino/Wiring/Processing environment will cover all your needs.

Check out the Lightblue Bean (http://punchthrough.com/bean/) it is a good example of the power of that platform. Even experienced embedded programmers can use it, since the underlying register are still accessible.

I am now programming on the Ti MSP430, and while I can appreciate the possibilities, I miss the simplicity of Arduino; much easier to get started with Arduino.

Go to http://arduino.cc/en/main/software to download the 1.0.6. IDE software, plug your Arduino, go to Tools->Board to select your Arduino, select the appropriate "tty" port in the Tools->Serial_Port. Then write in pure C and download. There are tons of examples included with the IDE.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.