Hi, so I have a program that I am trying to create where I have an external LED connected to the board as well as a wire we use as a switch, the switch is supposed to start connected to the ground and another port, when I pull the wire out, the external LED should turn on and that should count as 1 iteration, I am supposed to make the program run for 10 iterations (pull out = 1, put back = 1) then stop working and have the internal LED blink when I have reached 10.
I am just not sure how to get the program to stop after the 10th iteration, I have tried to use a while loop but i'm not sure it's doing what its supposed to do since it doesn't work, I would appreciate any help with this, and I will post what code I have if needed, thank you!
Please read and follow the directions in the "How to use this forum" post. Post the code, using code tags.
You should learn to use a switch or pushbutton for input. "Pulling a wire out" is a terrible practice, leading to destruction of equipment, and is an extremely unreliable way of providing input to a computer.
jremington:
"Pulling a wire out" is a terrible practice, leading to destruction of equipment, and is an extremely unreliable way of providing input to a computer.
Yeah, but it's pretty common in disarm-the-bomb setups, isn't it?
Only a screenwriter would make a bomb that started to count if it was being disarmed..
But you actually want to change the flash from one pin to another..
So have a variable for the PIN number, and a variable for a counter and a if statement that when the counter is over 10 it changes the pin variable to the internal.