To program an Arduino with Eclipse you just need to follow the Arduino manual for C\C++. As it says, you need to:
AVR Cross Project Application.Upload project to target device AVR option).Probably you will have some troubles when upload it. You should configure your the AVRDUDE tool for your device. For a Duemilanove in Linux a configuration (chosen project properties) that works is…
You just need to download the template and extract and import its two projects in your Eclipse workspace. Now you can use the arduino library.
Blink:
#include <avr/io.h> #include <util/delay.h> int main (void) { long i; DDRB = 1 << 5; while (1) { PORTB = 1 << 5; _delay_ms(1000); PORTB = 0 << 5; _delay_ms(1000); } }
Heartbeat:
#include <avr/io.h> #include <util/delay.h> int main (void) { DDRB = 1 << 5; while (1) { PORTB = 1 << 5; _delay_ms(250); PORTB = 0 << 5; _delay_ms(250); PORTB = 1 << 5; _delay_ms(250); PORTB = 0 << 5; _delay_ms(1000); } }