|
******************************************
Welcome To CrazyEngineers (CE) – an online community of engineers from all over the world! With the younger CEan at 84 and the youngest at 16, CE boasts of professional engineers, students, professors, entrepreneurs, CEOs, geeks & nerds. We exchange innovative ideas, share knowledge, help each other and expand our worldwide network of engineers! You need not have a formal degree in engineering to be a part of CrazyEngineers! Need we say more? Join CE! | Be a CE Ambassador! | Forgot password? | Sponsor CE | Contact Us |
![]() |
| Sponsored links | |
|
|
|
|
Moderator
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
I'm a Crazy Communications Engineer
Join Date: 12th July 2007 Location: IIUM, Malaysia
Posts: 1,506
|
Ahmed, doesnt your solution mean it'll check twice: the second time AFTER a delay of 3 seconds? The condition stated in the problem is that the IR is received for a continuous 3 seconds before the motor will move. If you just delay it, you wouldn't know whether there was an interruption during the delay.
I think better we try adding a timer counter within a while loop, so when the timer reaches 3 seconds, we switch on the motor. Maybe we can take advantage of the TMR function of the PIC? When the conditions are met, run the timer, and check timer again continously. If there is an elapsed time of at least 3 seconds, then run the motor. Of course, timing is based on the clock frequency you are using
__________________
Keep it simple. Keep it real. | New to CE? Click here! | Join our CE Bot project! | Problems? Questions? PM or mail me at ash{at]crazyengineers{dot]com |
|
|
|
|
| Sponsored links | |
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
| Contact Us - Home - Impressum | Impressum - |