NEED SOME HELP!

I found a open source code on here I've been playing around with and try to use, but it doesn't seem to be working.

The function of it is: one team presses a button to control the location, and a stopwatch logs the amount of time the point is controlled, until the other team comes and presses their button. The the clock stops for the fist team (and displays the value) and begins for the second team...and so on and so forth.

I have the circuit built and programmed, but when I press the green button to begin...nothing happens.
Any help would be much appreciated...and I can paypal a few bucks to help with your time. Thanks in advance.

code attached.

Doomsday_Checkpoint.ino (7.15 KB)

Does this part of it execute:

  digitalWrite(blueledPin, HIGH);  //Turn on blue LED

  lcd.begin(20, 4);// set up the LCD's number of columns and rows:
  lcd.print("      DOOMSDAY");// Print a message to the LCD.
  lcd.setCursor(0, 1);
  lcd.print("  CONTROL POINT 01");
  lcd.setCursor(0, 3);
  lcd.print(" PUSH BLUE TO START");

That is, does the blue LED light and a message " PUSH BLUE TO START" appear on the LCD ?

yeah...that part works. wont let me past that though.

The first thing is that the requirements are not trivial, but your description of them appears good. Building it from scratch would probably take several hours and would probably not be a project you would want to pay for.

Secondly, my suggestion is that if you are not at the level where you can fully develop your own solution, that you find something that claims to do approximately what you want, get that working so it functions as the designer originally intended, then start modifying it in small steps to achieve what you want.

From what you have posted, you appear to have made significant changes between the 2 versions but without ever getting the thing working in any state. I don't recommend that you proceed like this.

Can you post a link to the 'open source code' you found in post #1 and say in how far this meets your requirements, assuming that it works as claimed. Then, assuming the original software is an adequate basis for your solution, the task is (a) getting the original code working and (b) adapting it, if necessary, to meet your requirements outlined in your second post.

well...the first code and the second code are actually two different project that I posted in two different threads, but someone seemed to combine them (for what ever reason and it seems without reading them)...making it a little confusing. The problem with the first code I think is just a simple hardware problem or need to debounce the buttons (from what I understand) so i'm going to try that. the second...is...like I said...a completely different project.

The second code is something i found a long time ago and has worked thus for (I usually just find thing that are about what I need them to do and make little tweeks here and there.

Unfortunately, I cant seem the tweek this one. (I can post the original code if that helps, but its rather long...just let me know). The original sketch has several different tabs, with multiple different modes run off a menuPrincipal sketch. I tried just extracting the mode I wanted as well as all the other the relevant code to make it function...and I think I'm close. I'll compile...fix the issue...compile...fix the issue...and so on and so forth.

Any help would be greatly appreciated...and not expected for free.

ChargerCop:
I found a open source code on here I've been playing around with and try to use, but it doesn't seem to be working.

The function of it is: one team presses a button to control the location, and a stopwatch logs the amount of time the point is controlled, until the other team comes and presses their button. The the clock stops for the fist team (and displays the value) and begins for the second team...and so on and so forth.

I have the circuit built and programmed, but when I press the green button to begin...nothing happens.
Any help would be much appreciated...and I can paypal a few bucks to help with your time. Thanks in advance.

Your descriptions sounds like you want an inverted chess clock".

A chess clock works like that:
If it's turn for "white" to do a move, the white time is counting.
When the white player has done his move, he presses a button, the white time stops and the black time is counting.

If the time for one player reaches a fixed amount of time and the game is not yet ended, the game is over and the player who ran out of time loses the game, while the player with time left on his clock is the winner.

What you described is somewhat similar to a chess clock, except there is no "final time" and you don't have just two players (white and black) but you have three players (yellow,green,blue) and the time is not running against the opponents (who did not push their button), but time is running pro the player who pushed his buttons.

How are the buttons connected?

As you are using pinMode INPUT I'm assuming your button circuits contain pull-down resistors? Or not?

How long are the wires from Arduino to the buttons? Is it more than 60cm (0.6m or 2 feet) wire length from Arduino to button(s)?

I've actually got the code real close. Its doing what I want it to do, except, a team can only "capture" the zone by pressing either "D" or "C" on the key pad. I'm trying to get it so they press a separate arcade style button instead.

sketch_feb04a.ino (16.3 KB)

The second time a team presses the button, do you add in the amount of time from the first time? Or is that cleared?

And, where re you located?

-jim lee

This is the code that senses a press on the green button:

 if (greenbuttonval == LOW && greenprevious == HIGH && millis() - greenfirstTime > 200) {
    greenfirstTime = millis();    // if the buttons becomes press remember the time
  }

it does nothing unless greenprevious=HIGH. You do not initialize greenprevious in your sketch, so this code doesn't get executed.

Still - that should fix itself after you press and release the green button a couple of times. Hmm...

You use the runEvery macro to update the display. This means that the display won't get updated unless the buttons are held down at the one-second mark when the display happens to update ... but that's not a huge deal. Presumably you test this thing by holding down the green button.

 if (greenbuttonval == LOW && ((millis() - greenfirstTime) % 1000) < 20 && millis() - greenfirstTime > 500) {
    ledblink(1, 50, greenledPin); // Each second the button is held blink the indicator led and
    greencount++;        // and 1 to the counter
  }

Why ((millis() - greenfirstTime) % 1000) < 20 and not simply millis() - greenfirstTime < 20000L ?

In any case, the above fragment won't increment greencount once per second, it will increment it once per loop (thousands of times a second) when greentime is between 1/2 second and 20 seconds.

Personally - I'd just rewrite this thing.

Personally - I'd just rewrite this thing.

Yep. Separate the state change detection bit from the debouncing bit. They are two independent activities.

And, ditch the useless comments. Anyone can see that x++ increments a counter.