Reply To: PIC16F877A with DC Gear Motor

Home Forums Microcontrollers PIC Microcontroller PIC16F877A with DC Gear Motor Reply To: PIC16F877A with DC Gear Motor

#11481
Shengo
Participant

Hi there, sorry to disturb you again. I have tested the above code with my PIC16F877A, when I have input for RD0, LED 1 turns on (I replace motor with LED first for testing). Then when I have input for RD1, the LED 1 turns off then LED 2 turns on for 5 seconds and turn off, but once it has turned off, LED 2 lights up again, then after 5 seconds it turns off again and this loop keeps on repeating.

 

I wonder if those code you posted in your website is all on looping? If I just want all the sequence above just to happen once, and then when I press the push button again, the sequence happens again, I don’t want them to be repeating by themselves, shall I just remove the part “do while”?

Or should I use any “return” command for my code in order for them to return to all original state after the sequence finish?

Thank you for your advice. Your quick reply is very much appreciated.

>