I am stuck in some compile time error and not getting the solution for it.
This is the code I have made:
void setup() {
Serial.begin(9600);
pinMode(13,OUTPUT);
}
void loop() {
Serial.println("How many times you wanna blink the LED?");
String myString;
while(myString.equals("")) {
myString = Serial.readString();
}
long int mystring;
mystring = myString.toInt();
Serial.print("Okay! the LED will blink ");
Serial.println(myString);
Serial.print(" times.");
Serial.println("In how much time you want the LED to blink once? Please tell the time in milliseconds.");
String mystr;
while(mystr.equals("")) {
mystr = Serial.readString();
}
long int myint;
myint = mystr.toInt();
Serial.print("Okay we will blink the LED in ");
Serial.println(myint);
Serial.print(" milliseconds once.");
Serial.println("See the Show!!");
int ms;
ms = myint / 2;
while(int i = 0; i < mystring; i++) {
digitalWrite(13,HIGH);
delay(ms);
digitalWrite(13,LOW);
delay(ms);
}
}
and this is the error I am getting again and again.
Arduino: 1.8.10 (Windows 8.1), Board: "Arduino/Genuino Uno"
D:\ANSH new\Arduino\Blink_LED_user_Input_Times\Blink_LED_user_Input_Times.ino: In function 'void loop()':
Blink_LED_user_Input_Times:36:17: error: expected ')' before ';' token
while(int i = 0; i < mystring; i++) {
^
Blink_LED_user_Input_Times:36:19: error: 'i' was not declared in this scope
while(int i = 0; i < mystring; i++) {
^
exit status 1 expected ')' before ';' token
This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.