better way


Closed Thread
Results 1 to 9 of 9

Thread: better way

Hybrid View

  1. #1
    Join Date
    Sep 2005
    Location
    Dayton, Ohio
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    Well, at least you are attempting a fairly simple program to start. The big mistake I ALWAYS make is that I write 2 pages of code before testing any of it. Or I make too many edits. Then I spend a week debugging. I know I should do one thing at a time and test each new function as it is added, but it's easy to get carried away...

    Something to think about...there are still some shortcomings with the way I modified your code: The loop that looks for the second and third events should be fairly close to 60 seconds. But...when either of those events is detected, it will ADD 5 seconds to the overall loop time.

    Also, you will miss any events that occur while the LED is on or the Horn is on. But that might be okay for your application. I was mainly trying to stay as close to your code as possible so you can understand the changes.

    Charles is using a timer and interrupt flag, which is one of those "more elegant" solutions......IF you understand how it all works....otherwise you just might only make things harder for yourself to debug down the road.
    Jim Robertson
    "MilesTag" DIY Lasertag
    www.lasertagparts.com/mtdesign.htm
    Dayton, Ohio

  2. #2
    trying's Avatar
    trying Guest


    Did you find this post helpful? Yes | No

    Default

    thanks
    milestag I just had to add 1 then and change spelling on montior for it to compile and it seams to work like planned. I will insert it in to the rest of my code to see how it works.
    Charles yours is a little over my head right now BUT you have givien me some thing to work on thanks for that and I may ask for a little help from you on how-to.
    update later
    thanks again

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts