Go Down

Topic: Yet another Arduino Airsoft Bomb Prop! (Read 802 times) previous topic - next topic

Denieunko

Hi!

I've made an airsoft bomb prop using this:
Link to the instructables.com

,but some of the code there won't cut it. The bomb has to be able to accept a 7 digit password (that i could achieve) for arming and defusal and (more importantly) - the user ahs to be able to set the timer using the keypad included.

Im no programing expert, well, I wouldn't even say that i know anything about programing Arduino, so succeeding in this case isn't possible and if anyone is willing to have some fun writing the code for me, it would be highly appreciated.

Here is how the circuit looks like:


I've attached the code i used so far. It works, but you cant type in the data for the timer from the keypad.

PaulS

Quote
if anyone is willing to have some fun writing the code for me, it would be highly appreciated.
How highly?
The art of getting good answers lies in asking good questions.

Denieunko

How highly?
Well, I won't be able to actually finish this project any time soon, because i will have to learn how to program this kind of thing. So the answer is, very appreciated.

PaulS

Code: [Select]
    char key = keypad.getKey();
    key == NO_KEY;
    if (key != NO_KEY)

Why are you comparing key to NO_KEY, and throwing away the result of the comparison?
Code: [Select]

  while (currentLength < 7)
  {
  }

  if (currentLength == 7)
  {

How can currentLength NOT equal 7, when the while statement has no break statements?

Code: [Select]
               void software_Reset();
               {
                 asm volatile ("  jmp 0");
               }

Why do you have a function defined inside another function?

Your code seems to think that getKey() is a blocking function. It is NOT. If no key is being pressed, the function returns NO_KEY. The code in the while loop in timer() makes no sense.

Code: [Select]
          Scount --; // add 1 to Scount
I suppose that ++ subtracts one in your world...

Code: [Select]
          delay(10); // waits for a second
It does not.

If you are going to have useless comments, you MUST make the code match the useless comment.
The art of getting good answers lies in asking good questions.

Denieunko

I'm sorry.

That code is taken from the instructables website (link in original post), and all of those comments and solutions are done by the original author. The code isn't done by me and now i see i haven't mentioned that in the first post - that's why im sorry.

You found a lot of mistakes, so if you think this code is done poorly from the beggining you could start all over with an empty sheet - that's why i've attached the schematic above.

What is interesting is that with all those mistakes in the code the device works all right, although it lacks the function im interested in (typing in the time for the timer).

All of the diferences between my code and the original are minor (besides the code connected to the keypad - original code has different pins for the keypad compared to my keypad).

vaj4088

If you want to correct the issues that have been pointed out to you, go ahead.  If you want code written for you, you should post in "Gigs and Collaborations".  You should probably bring your wallet.

Denieunko

Scince this post was moved to the right section, maybe there will be someone awsome to help out?

patduino

There are 10 types of people in the world, those who understand binary, and those that don't.

patduino

Quote
How highly?
So if anyone is following this thread, I ended up doing this pro bono.  

I didn't really try to fix the op's code or his comments and added the requested features in the style of the existing coding to minimize impact -- so don't grade me on this one!

Pat.
There are 10 types of people in the world, those who understand binary, and those that don't.

Riulsadam

Hello Sr. Patduino, y send you a message to see him something that notices he knows coding. I appreciate respond to the email I put. Thanks

By the way very good attitude on your part to help here. Greetings from Uruguay

patduino

Hi Riulsadam,

I received your PM and have responded with an email as requested.

Pat.
There are 10 types of people in the world, those who understand binary, and those that don't.

Go Up