I have an issue i dont know if there any solution for it. I want to program a DC motor to run for 1 minute
to the right,and then it turned off. the problem is that,for example if the power cuts off at 20 second,and
when I connect the power again ,it will be stopped in a position when the power cuts off( 20
second),and if i want to run the motor again ,it will go for new 1 minute. is there a way so the motor continue the 40 second that was not finished before?
Yes, you could put limit switches at both ends and sample them at boot time. Otherwise, you need to store the position somewhere that survives a power down, like EEPROM (but that typically frustrates beginners).
is it possible to give me a simple code for that???
i want to replace the dc motor at main time with light and push button,so i can understand it better,
so the light will turn on for i minute,and if the power cut off, at 20 seconds, when the power get back, and i press on push button the light will turn for 40 seconds and then turn off.