Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic "Serial.available" always returns true even if no data (Read 4326 times)
_templaries_
Newbies
*
Offline


Posts: 1
Joined: Oct 19th, 2015
"Serial.available" always returns true even if no data
Oct 19th, 2015 at 8:05am
Print Post  
I have got this code that works using Arduino IDE, but fails in Visual Micro.

Code
Select All
        if (Serial.available())
	{
		for (int i = 0; i < 128; i++)
			last_command[i] = '\0';

		char end_char = '\n';
		Serial.readBytesUntil(end_char, last_command, 512);
		return true;
	}
	else
	{
		return false;
	}
 



I use Arduino ONE, IDE Arduino 1.6 and no programmer to upload.

Thank you.
« Last Edit: Oct 19th, 2015 at 8:05am by _templaries_ »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: "Serial.available" always returns true even if no data
Reply #1 - Oct 19th, 2015 at 1:48pm
Print Post  
Hi,

I think this is because the debugger is active and your code shares the serial port with the debugger.

1)
You can switch the debugger to using a different serial port or use one/two digital pins. See this article for more info.

Or 

2)

You can switch the tool bar from "Local windows debugger/Debug" to "Release". Then upload and Visual Micro will work the same as the Arduino ide .

...

Let me know if still an issue?
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint