VS Arduino
>> >> Program runs in an infinite loop
https://www.visualmicro.com/forums/YaBB.pl?num=1432629186

Message started by fnc13 on May 26th, 2015 at 8:33am

Title: Program runs in an infinite loop
Post by fnc13 on May 26th, 2015 at 8:33am
I have created a program in Arduino IDE and I've successfully put it in VS 2013 Community (I've installed Visual Micro as well). I was able to choose the port, the Arduino board, but VS has underlined some functions like pinMode, digitalWrite, OUTPUT, Serial, LOW.... and when I get the cursor over them it says: "Error: Identifier undefined". The program uploads successfully on the board, but it goes into an infinite loop (I've tried it in Arduino IDE and it works perfectly)

Title: Re: Program runs in an infinite loop
Post by Visual Micro on May 26th, 2015 at 10:43am
Hi,

Thanks for the post.

When you say infinite loop do you mean the board just keeps rebooting? setup then loop?

Please switch the tool bar from "debug" to "release2 or untick "tools>visual micro>automatic debugging"

If that fixes the issue the problem was probably a breakpoint in an invalid location but I will explain more about that after you confirm if that was the problem.

Thanks, please also confirm which version of Arduino you have installed and which board you are using.

Title: Re: Program runs in an infinite loop
Post by fnc13 on May 26th, 2015 at 11:06am
I am using an Arduino Uno board and Arduino IDE 1.0.6.
When I said that it goes into an infinite loop, I meant to say that the program starts but it doesn't wait for a command. It takes all the command one by one, and then it repeats this all over again. (the program should have waited for the user to give a command, like "Aon", or "Aoff" - which is memorized into a string variable; but instead it runs all the commands).
I think i know where the problem is, but I haven't fixed it yet: it's on the string variable. VS doesn't recognise the string tipe; and also, I used a character to be added to the string using the operator "+", and it shows an error there as well.
The thing it's working perfectly on Arduino IDE...

Title: Re: Program runs in an infinite loop
Post by Visual Micro on May 26th, 2015 at 11:20am
Thanks for the info.

I think this is possibly just some confusion. Hopefully you are using the Arduino 1.0 option in Visual Micro?

1)
VS intellisense is entirely separate to compile. So you can ignore what VS says is correct or not. We will address the intellisense issue when we have solved the loop.

2)
Visual Micro handles the compile fully. VS does not have any connection to it so you should have the same problem in the Arduino Ide. You can see the exact compiler commands by switching on "tools>visual micro>verbose" and "arduinoide>file>preferences>verbose compile"

I suspect that the code you are using in Visual Studio is slightly different to to the Arduino ide. I can tell you that if you append to a string so that it becomes larger than the assigned amount of memory then the arduino will crash and appear to be in an infinite re-start loop.

Please try the identical code in the arduino ide.

Thanks

VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.