I have the same problem and I didn't find any place that shows me how to make it works.
I have this code:
#include <Arduino.h>
#include <HardwareSerial.h>
#include <Print.h>
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
Serial.begin(9600);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
static int i =0;
Serial.print("Test:"); Serial.println(i);
i++;
}
I had to include the arduino.h lib to make the eclipse understand the digitalWrite. The arduino ide can recognize it alone. I tried to insert HardwareSerial.h and Print.h to make it understand the serial communication, but I receive nothing. I also stopped the serial monitor of eclipse and oppened the Arduino IDE serial monitor to see if I make some mess at Eclipse Serial Monitor and I didn't receive any message as well. I think that maybe I need to add some extra lib, but I don't know witch and this is what I am looking for. Anyway this code is uploaded to arduino nano without any problem. I used Eclipse Neon, Windows 10, Arduino IDE 1.6.7.
I tried to insert HardwareSerial.h and Print.h to make it understand the serial communication, but I receive nothing.
If the code compiled without them (and I'm sure that it did, because Arduino.h includes them), then including them is not what will magically make the Arduino send data to whatever port you are listening to.
I think that maybe I need to add some extra lib
No, you don't.
Compile that code using the IDE. Upload it to the Arduino. Open the Serial Monitor application. Do you get data?