I was doing some project from youtube and I did just like him. But I got a lot of errors that I don't understand and I spend an hour and a half on looking for answers. I'm totally new in this so I still don't understand everything. I would really appreciate your help.
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.
Link of video: Arduino Programming - YouTube
Thank you ahead
ERROR_420