This is an exmple of a code writen with the IDE and tested with the termnal include into IDE. Every thinks are OK, the Serial.available() works fine.
setup()
{ Serial.begin(57600) ;
Serial.println("Hello, world!") ;
...
}
loop()
{... i = Serial.available() ; sprintf(errmsg," AVAIL %d",i); Serial.println(errmsg) ; ...
Every thinks are OK.
Now, I write the same code in C language with the plugin eclipse (Arduino Eclipse IDE named Sloeber - Welcome!), with the same hardware, on the same computer, the same USB port, .... of course I can load the code on the target. The println command works fine, but the available() commande always return 0. I use the IDE terminal as terminal like in the first example.
Have you some ideas ? Do I use the right RX port ? A configuration ? Does the IDE libraries are the same as the C libraries ?
SoftwareSerial mySerial(0,1) ; // RX, TX == 1
void setup()
{
mySerial.begin(57600) ;
mySerial.println("Hello, world!") ;
...
}
void loop()
{ ...
j = mySerial.available() ; sprintf(errmsg," AVAIL %d",j); mySerial.println(errmsg) ;