Vor ein paar Tagen hatte ich hier beschrieben, wie ein Arduino mit der Arduino IDE geflasht wird. Als Java-Entwickler will man am Besten alles in Eclipse machen. Also auch die Arduino-Programmierung. Das geht auch mit dem Eclipse C++ IDE for Arduino 2.0. Für den Anfang ist wohl die Arduino IDE etwas einfacher zu bedienen. Aber mit dieser Anleitung geht es auch in ca. 1 Stunden. Also los …
Über den Eclipse Marketplace installieren:

Das dauert etwas …
Dann ein Arduino Projekt anlegen:

Es gib nur ein Template:

Das CPP Gerüst wird dann schon mal erzeugt:

Nun brauchen wir einmalig eine Connection vom Typ Arduino


Mit ein paar Parametern zur Schnittstelle:

In meinem Fall das Arduino Nano Board:

Und für ein Beispielprojekt eine Lib (ug8lib) für das Display:


Nun kann die Lib auch dem Projekt hinzugefügt werden:

Nun ersetzen wir das Template mit diesem Beispiel Programm:
#include <Arduino.h>
#include "U8glib.h"
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_DEV_0);
void drawTest(void) {
u8g.setFont(u8g_font_unifont);
u8g.drawStr(0, 20, "OK, Start...");
}
void setup() {
u8g.firstPage();
do {
drawTest();
} while (u8g.nextPage());
}
void loop() {
delay(2000);
u8g.firstPage();
do {
u8g.setFont(u8g_font_osb18);
u8g.setFontPosTop();
u8g.drawStr(10, 10, "Dont give");
u8g.drawStr(10, 30, "up! Eclipse");
} while (u8g.nextPage());
}
TIP! Dabei beachten, das im Gegensatz zur Arduino IDE noch ein
#include <Arduino.h>
hinzugefügt werden muss. Sonst gibt es Compile-Fehler, das Methoden nicht gefunden werden.
Jetzt oben auf den Hammer in der Toolbarleiste für den Build und dann ein klick auf den grünen Run Button, und schon wird das Programm auf den Nano hochgeladen.
avrdude: Version 6.3, compiled on Jan 17 2017 at 12:01:35
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/Users/userdir/.arduinocdt/packages/arduino/tools/avrdude/6.3.0-arduino9/etc/avrdude.conf"
User configuration file is "/Users/userdir/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/cu.usbserial-A9SV31TT
Using Programmer : arduino
Overriding Baud Rate : 57600
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : Arduino
Description : Arduino
Hardware Version: 2
Firmware Version: 1.16
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file "./Anzeige.hex"
avrdude: writing flash (17700 bytes):
Writing | ################################################## | 100% 8.89s
avrdude: 17700 bytes of flash written
avrdude: verifying flash memory against ./Anzeige.hex:
avrdude: load data flash data from input file ./Anzeige.hex:
avrdude: input file ./Anzeige.hex contains 17700 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 7.52s
avrdude: verifying ...
avrdude: 17700 bytes of flash verified
avrdude done. Thank you.
Hier noch ein Foto der IDE:

Und hier das Ergebnis „Dont give up! Eclipse“:

Ähnliche Artikel:
- Arduino IDE für den ESP8266 nutzen (Entwicklung und Upload)
- Arduino: Wie können RFID Tags eingelesen werden?
- Eclipse go to Mars 4.5 Release oder wie wird Eclipse Mars auf dem Mac OS X installiert?
