Go Down

Topic: Problem Serial.available() = 0, ( SOLVED ) (Read 485 times) previous topic - next topic

ignaciot

May 14, 2013, 07:32 am Last Edit: May 14, 2013, 06:53 pm by ignaciot Reason: 1
hi, i always control arduino via serial  without problem. but I changed my pc, and i cant send data from pc to arduino, and now when I do it I always obtain "Serial.available() = 0"
even with the most basic program to do it i obtain "Serial.available() = 0"

Code: [Select]
void setup() {
   Serial.begin(9600);
}
void loop() {      
if (Serial.available() > 0) {
}
       else{
           Serial.println("serial is not available");
}}


i always obtain "serial is not available" in my new pc, i return to the old pc and  works perfect

can any help me? thanks!

pYro_65

You need to send data to it for any other result. Serial.available() only returns the number of bytes in the receive buffer, not weather the serial functionality is available.

ignaciot

#2
May 14, 2013, 07:48 am Last Edit: May 14, 2013, 07:51 am by ignaciot Reason: 1
i always send data from monitor serial or matlab to arduino, but now these data are not read. obviously i erase this line
Code: [Select]
Serial.println("serial is not available");
in my programs

UKHeliBob

What baud rate is the Serial monitor set to ?
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.


ignaciot

i think that my PC have a driver problem, but i can send data via serial using serial.print from arduino to PC.

ignaciot

I solved it! at left  "blaud rate" in monitor serial I select "carriage return". thanks!

UKHeliBob

That does not make any sense. 
What you have done is to tell the Serial monitor to append a Carriage Return to the text sent to the Arduino, but the code that you posted does not rely on the CR being present.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Go Up