topleft topright

Results 1 to 3 of 3
  1. #1
    Just Joined Array
    Join Date
    Nov 2011
    Location
    Texas
    Posts
    1

    Programming a Scoring Box Help

    Hey Gang! I'm using my senior electrical engineering design to make a wireless scoring box.

    I am using an arduino nano to be the microcontroller. My main concern is how to do the lockout of the second fencer after having been hit.


    I have the current logic as

    if (avalue==high) //please note that the A line is a filtered signal that if high means you got hit
    {
    lockout++;
    }

    for (int i=0; i<=foiltouchduration_min; i++) {

    if(avalue==HIGH)
    {
    lockout++;
    }

    if(Cvalue==HIGH & Bvalue==HIGH & i==foiltouchduration_min & lockout!=foil_window) //if not inlockout
    {
    output_colored_light();
    lockout=0; //clear lockout time to zero
    }

    else if(foilCvalue==HIGH & foilBFILTvalue==LOW & i==foiltouchduration_min & lockout!=foil_window )
    {
    output_white_light();
    lockout=0;
    }
    }


    if (lockout==foil_window) //if lockout timer has reached limit time
    {
    lockout=0;
    delay(2000); //delay for 2 full seconds
    }

    }


    The great thing is that the logic works great, except for lockout for when the fencer gets hit and that its slow. (obviously this is not the full code) My team mate noted that foil_window>foiltouchduration so it will never get to the proper time.



    Any inspirations on how to do this from my fencing programmers? Any help would be greatly appreciated! I have looked at Eric's open source machine, but that is all in assembly and is hard for me understand.


    Anyway, thanks again!

  2. #2
    Just Joined Array
    Join Date
    Oct 2009
    Posts
    25
    To be correct instead of sampling with a for loop you must have interrupts of pin state changed,
    then you need a debouncing procedure to avoid noise and meet FIE requirements of minimun time to touch required

  3. #3
    Senior Member Array jjefferies's Avatar
    Join Date
    Dec 2005
    Location
    Alameda, CA
    Posts
    2,386
    Quote Originally Posted by 22hansen22 View Post
    To be correct instead of sampling with a for loop you must have interrupts of pin state changed,
    then you need a debouncing procedure to avoid noise and meet FIE requirements of minimun time to touch required
    Could you explain your reasoning. Polling within a while loop could be the main loop with the debounce a part of the polling. Past experience has been that polling has advantages over an interrupt off unknown hardware and the OP hasn't indicated what his inputs are to be. Ach, the OP said "wireless" so there's probably no debounce needed just a signal received from some source. Think it depends on how he cares to distribute the functionality among the various parts of the system.

    Question to OP, my assumption is that you are having other pieces as the wireless and the arduino nano chip as the timing. What functionality are you wanting to include in the project? I'm just wondering if the chip has enough I/O for you.
    Last edited by jjefferies; 11-20-2011 at 12:52 AM.
    J Jefferies

Similar Threads

  1. Coaching: Pair Programming?
    By jBirch in forum Fencing Discussion
    Replies: 6
    Last Post: 09-19-2006, 01:48 PM
  2. Scoring box
    By vincikai in forum Armory - Q&A
    Replies: 15
    Last Post: 03-20-2005, 01:16 PM
  3. Scoring box
    By vincikai in forum Armory - Q&A
    Replies: 0
    Last Post: 03-12-2005, 02:12 PM
  4. Scoring Box
    By Broadsider in forum Rec Sport Fencing
    Replies: 1
    Last Post: 02-21-2005, 02:28 PM
  5. Scoring Box
    By Broadsider in forum Rec Sport Fencing
    Replies: 1
    Last Post: 02-10-2004, 07:00 AM

Tags for this Thread

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30