Visual Micro - Visual Studio Millis() error

Hello!

This is my fisrt time with Arduino - Visual Studio, so I’m a bit lost.
I want to do a simple program in Visual Micro, printing out Fibonacci’s values. For this, I have used Serial.print, by defining Serial.begin first.

I couldn’t find a way of printing anything out. I tried debugging with the same command, but there is a problem in my void loop() line. The error message is:

When ‘millis()>0 || millis()>1’ is true an hit count is a multiple of 250. Millis is currently {Millis()}

I don’t have a clue of what that means or how I can fix it.

This is my code. If anyone could help me I would be really thankfull, didn’t find much info over the internet.

#include <stdio.h>
#include <HardwareSerial.h>

int main(){
Serial.begin(9600);
}

int Fibonacci(int f0, int f1) {
int fn;
return fn = f0 + f1;
}
void loop(){
int f0, f1, fn, i;
f0 = 0;
f1 = 1;
for (i = 0; i > 6; i++){
fn = Fibonacci(f0, f1);
Serial.println("Fibonacci value: ");
Serial.print(fn, ‘\n’);
f0 = f1;
f1 = fn;
}
}

Why not use the Arduino IDE, it works…

Try removing the two header files and just include <Arduino.h>

marco_c, I just tried that and the same error message comes up :( Don't know what could be wrong, I saw other examples on the internet that don't work for me either.

MarkT, It does compile and it uploads from Arduino IDE, but I need the results to be printed out somewhere. I read on the Internet that people connect Visual Studio to Arduino for this purpose. If you know any other way, please let me know! I've only used Arduino for a month or two and I never tried printing out things on to the computer.

Thanks a million to both!

The IDE has a serial monitor where you can get output from your Arduino. You can use any other serial terminal program if you don't like that one to read serial data from your Arduino, it doesn't matter what you used to upload the code.

Visual Studio also has a serial monitor. You need to make sure that whatever you use the PC is ready to receive the message by running software that will display what is received from the serial connection to the Arduino. The serial connection must be set to the right speed (as initialised in Serial.begin) or you will get gibberish.

I would suggest that if you are not experienced in programming then stick with the Arduino IDE for the moment - it is simpler and more people can help you.

int main(){
   Serial.begin(9600);
}

This should be "void Setup() {" rather than main.

int Fibonacci(int f0, int f1) {
   int fn;
      return fn = f0 + f1;
}

I don't think that this does what you expect it to do... (And I'm not sure what you expect it to do. It certainly won't calculate fibonacci numbers.)

Hmm, missed that main() instead of setup(). I have been programming Arduino style for too long ...

If you are using Visual Studio with Visual Micro plugin Just turn off "Vmicro>General>Tutorial mode"