I am a Beginner.
I successfully created/saved a very simple sketch, where the purpose was to make the builtin LED in my Adruino Uno board to blink 10 times and then exit the Loop/Stop blinking. I used "for", "if" and "break" in this sketch.
As mentioned, I was able to successfully verify and save this sketch (see attached screen capture), however when I uploaded and ran the sketch, the builtin LED continued to blink past 10 times.
Please post your code in [code] [/code] tags, not pictures of your code.
Your for statement looks really strange.
You don't need to manually break a for loop.
Everything is inside loop() so once you've flashed your LED 10 times, then loop will restart and flash it another 10 times, and another, and another...
Everything is inside loop() so once you've flashed your LED 10 times, then loop will restart and flash it another 10 times, and another, and another...
If you want the 10x blinks to happen only once, either:
Put the for in setup(), since setup() itself runs only once
Use a boolean flag, called say "done10Blinks", intitialsed false. Then put your for in an if which checks the flag is false. When the for is done, set the flag to true, so next time through loop() the if will fail and the for won't run again
You increment a on every iteration of loop. It will very quickly overflow and be less than 10 again, hence the flashing. Move the increment inside the braces for the if.