So i need help im new in this plz ARDUINO MKR1000

So I build code from YouTube and it puts a lot of errors that I don’t understand and nowhere I could find answers. Here is code:

const int ledPin = 13;

void setup() {
  Serial.begin(9600);
   pinMode(ledPin, OUTPUT);
 

}

void loop() {
  int delayPeriod = 100;
  int countDir = 1;
  digitalWrite(ledPin, HIGH);
  delay(delayPeriod);
  digitalWrite(ledPin, LOW);
  delay(delayPeriod);
  
  countDir = checkDirChange(delayPeriod, countDir);

  delayPeriod += 100 * countDir;
  Serial.print("new wait time:")
  Serial.println(delayPeriod)
  }

  int checkDirChange(int delayPeriod, int countDir){
    if((delayPeriod == 1000) || (delayPeriod == 0)){
    countDir *= -1;
    
    if(countDir <0){
      Serial.println("going down");
      
    } else {
      Serial.println("going up");
    }
}
return countDir; 
}

AND HERE ARE ERRORS:

In file included from C:\Users\adria\OneDrive\Dokumenti\ArduinoData\packages\arduino\hardware\samd\1.6.21\cores\arduino/delay.h:23:0,

                 from C:\Users\adria\OneDrive\Dokumenti\ArduinoData\packages\arduino\hardware\samd\1.6.21\cores\arduino/Arduino.h:81,

                 from sketch\Tut_1.ino.cpp:1:

C:\Users\adria\OneDrive\Dokumenti\Arduino\Tut_1\Tut_1.ino: In function 'void loop()':

C:\Users\adria\OneDrive\Dokumenti\ArduinoData\packages\arduino\hardware\samd\1.6.21\variants\mkr1000/variant.h:200:37: error: expected ';' before 'SerialUSB'

 #define Serial                      SerialUSB

                                     ^

C:\Users\adria\OneDrive\Dokumenti\Arduino\Tut_1\Tut_1.ino:22:3: note: in expansion of macro 'Serial'

   Serial.println(delayPeriod)

   ^

exit status 1
Error compiling for board Arduino/Genuino MKR1000.

I would like your help because I’m very very interested in this and I’m still young.

I’ve edited your code and the error messages by adding triple backticks at the beginning and end.
Triple backticks look like this:
```

Please add them yourself in future, otherwise your unformatted code will be removed.

Pete.

what do you mean by adding triple backticks at the beginning and end.
at beginning and end of code?

can you paste example because i tried and it says Tut_1:1:1: error: stray ‘`’ in program I’m using Arduino program for coding

The Triple back ticks is just so the forum formats the code not in Arduino IDE. Use the code builder examples at the top of the screen and play with it from there to try and get your project working. Also search clean up your void loop on this forum. Hint: Your void loop is usually only two items with Blynk.

Here is the link of that project and I did everything same as you see and its work for him and don’t work for me I spend an hour and a half on looking for answer

also, please spend 5 minutes and read the forum rules and advices on how to create a new topic. the “issues and errors” category is related for blynk issues and errors, not to your coding skills.

Do I need to delete this then?

no, i already edited the category for you :wink:

Oh, thank you. Sorry I’m new in all of this so :smile:

Can’t watch the video now but your code doesn’t involve blynk at all. Maybe try posting it on the Arduino forum if you don’t want blynk.

What is blynk ?

2 Likes

Blynk integrates your phone to Adruino

Ok, thank you, everybody. I’m leaving and going on Arduino forum.

Happy trails. Once you learn C+ aka Arduino you may be back to play with these cute little thing via a phone. :+1:t3:

:rofl::rofl::rofl:

2 Likes