please just help me to finish this programm
I made this programme by taking example of you're code...
void loop() {
for (int i = 0; i = 50; i++) // we turn the motor
{
analogWrite(3, i);
delay(10);
}
buttonState = digitalRead(buttonPin);// reading of the sensor
if (buttonState == HIGH) // if something is detected
{
digitalWrite(ledPin, HIGH); // LED on
for (int i = 50; i = 0; i++) // We stop the rotation of the motor
{
analogWrite(3, i);
delay(10);
}
}
}
And now here is my code at the part void loop...
But it gave me a lot of error that i don't understand...
for (int i = 0; i = 0; i++) // we turn the motor
{
analogWrite(3, i);
delay(10);
for (int i = 0; i = 50; i++)
{
analogWrite(3, i);
delay(10);
}
}
buttonState = digitalRead(buttonPin);// reading of the sensor
for (int i = 0; i = 50; i++);
{
analogWrite(3, i);
delay(10);
buttonState = HIGH;
if (buttonState == HIGH) //si quelquechose est detecte
{
digitalWrite(ledPin, HIGH); //on allume la LED
for (int i = 0; i = 0; i++) // we turn the motor
{
analogWrite(3, i);
delay(10);
}
}
}
}
About the error it say:
In function 'void loop()':
27:22: error: name lookup of 'i' changed for ISO 'for' scoping [-fpermissive]
27:22: note: (if you use '-fpermissive' G++ will accept your code)
You know i try to keep the thing that i understand about my code like for the code to move the motor:
for (int i = 0; i = 50; i++) //the motor turn
{
analogWrite(3, i);
delay(10);
}
But i change the structure by taking example by you're code...
Please just help me adjust the error...
And help me about the structure not the code but the structure of my code that need to be similar to the structure of you're code...