Can somebody create a code for me?

I just joined and have no idea yet how to program. But could somebody simply create a code for me?
I have 6 buttons on a vending machine and I need to be able to make a 6 digit combination password to send a 5vto 12v signal from UNO board to unlock a cabinet indefinitely until I push like button 2 three times to turn the signal off and reactivate the electromagnetic lock. I have a UNO3 board and a 12v access control power supply
Also would it be necessary to use a 4 relay shield or is the UNO sufficient?

Welcome to the forum

The forum is not generally a code writing service unless you are willing to pay for it

Is that what you want to do, or would you rather do your best to write the code yourself and get help here for any problems that you have

I would gladly pay a reasonable fee to get this working right now. Im gonna learn but I really dont want to wait weeks learning before I get this initially working

Your topic was MOVED to its current forum category which is more appropriate than the original as you are prepared to pay for the code to be written

What's your budget?

well I know this is a 10 minute code for somebody that knows what their doing I wouldnt expect to pay much

I found this code online which does the basic code but I dont need the LED's and I need to add the triggering the 12v signal out and a password to deactivate the 12v out

const int button1 = 2; //first button is on pin 8
const int button2 = 3; //second is on pin 9
const int button3 = 4; //third is pin 10
const int button4 = 5; //fourth is pin 11
const int button5 = 6; //third is pin 10
const int button6 = 7; //fourth is pin 11
//const int LED[] = {14,15,16,17,18,19};

//const int Red = 8; //red LED is on pin 4
//const int greenLed = 9; //green LED is pin 12
void checkEntered1(int button);

int code[] = {6,5,5,4,3,2}; //the desired code is entered in this array,
                        //separated by commas

int entered[7]; //create a new empty array for the code entered by
                //the user (has 4 elements)

void setup(){ //run once at sketch startup
  Serial.begin(9600); //begin Serial

  pinMode(button1, INPUT_PULLUP); //button 1 is an input
  pinMode(button2, INPUT_PULLUP); //button 2 is an input
  pinMode(button3, INPUT_PULLUP); //button 3 is an input
  pinMode(button4, INPUT_PULLUP); //button 4 is an input
  pinMode(button5, INPUT_PULLUP); //button 3 is an input
  pinMode(button6, INPUT_PULLUP); //button 4 is an input

  //pinMode(Red, OUTPUT); //the red LED is an output
  //pinMode(greenLed, OUTPUT); // the green LED is an output
//  setupLights(); //run the setupLights routine
//  setupLights(); //run it again
 // delay(650); //delay (only for effect, :P not needed)
  //digitalWrite(Red, LOW); //turn the red LED on
  for (int i = 0; i < 6;i++){ //work through numbers 0-3
    Serial.println(code[i]); //print each digit of the code
    Serial.println(entered[i]); //print each element of the entered[]
                                //array (this was for me to check that it 
                                //started at 0
    //pinMode(LED[i],OUTPUT);
  }
}

void loop(){ //run repeatedly
  if (digitalRead(button1) == LOW){ //if button1 is pressed
    checkEntered1(1); //call checkEntered and pass it a 1
    
    delay(250);//wait, needed for correct functioning, otherwise
               //buttons are deemed to be pressed more than once
    
  }
  else if (digitalRead(button2) == LOW){ //if button2 is pressed
    checkEntered1(2); //call checkEntered1 and pass it a 2
    
    delay(250); //wait
    
  }
  else if (digitalRead(button3) == LOW){ //if button3 is pressed
    checkEntered1(3); //call checkEntered1 and pass it a 3
    
    delay(250); //wait
    
  }
  else if (digitalRead(button4) == LOW){ //if button4 is pressed
    checkEntered1(4); //call checkEntered1 and pass it a 4
    
    delay(250); //wait
    
  }
    else if (digitalRead(button5) == LOW){ //if button4 is pressed
    checkEntered1(5); //call checkEntered1 and pass it a 4
    
    delay(250); //wait
    
  }
    else if (digitalRead(button6) == LOW){ //if button4 is pressed
    checkEntered1(6); //call checkEntered1 and pass it a 4
    
    delay(250); //wait
    
  }
  

}

void checkEntered1(int button){ //check the first element of the entered[] array
//  digitalWrite(LED[button-1],HIGH);
  if (entered[0] != 0){ //if it is not a zero, i.e. it has already been inputted
    checkEntered2(button); //move on to checkEntered2, passing it "button"
  }
  
  else if(entered[0] == 0){ //if it is zero, i.e. if it hasn't been defined with a button yet
    entered[0] = button; //set the first element as the button that has been pressed
    Serial.print("1: ");Serial.println(entered[0]); //for debugging
  }
  
}

void checkEntered2(int button){ //check the second element of the entered[] array
//  digitalWrite(LED[button-1],HIGH);
  if (entered[1] != 0){ //if it is not a zero, i.e. it has already been inputted
    checkEntered3(button); //move on to checkEntered3, passing it "button"
  }
  
  else if(entered[1] == 0){ //if it is zero, i.e. if it hasn't been defined with a button yet
    entered[1] = button; //set the second element as the button that has been pressed
    Serial.print("2: ");Serial.println(entered[1]); //for debugging
  }
  
}

void checkEntered3(int button){  //check the third element of the entered[] array
//  digitalWrite(LED[button-1],HIGH);
  if (entered[2] != 0){ //if it is not a zero, i.e. it has already been inputted
    checkEntered4(button); //move on to checkEntered4, passing it "button"
  }
  
  else if (entered[2] == 0){ //if it is zero, i.e. if it hasn't been defined with a button yet
    entered[2] = button; //set the third element as the button that has been pressed
    Serial.print("3: ");Serial.println(entered[2]); //for debugging
  }
  
}

void checkEntered4(int button){  //check the third element of the entered[] array
//  digitalWrite(LED[button-1],HIGH);
  if (entered[3] != 0){ //if it is not a zero, i.e. it has already been inputted
    checkEntered5(button); //move on to checkEntered4, passing it "button"
  }
  
  else if (entered[3] == 0){ //if it is zero, i.e. if it hasn't been defined with a button yet
    entered[3] = button; //set the third element as the button that has been pressed
    Serial.print("4: ");Serial.println(entered[3]); //for debugging
  }
  
}


void checkEntered5(int button){  //check the third element of the entered[] array
//  digitalWrite(LED[button-1],HIGH);
  if (entered[4] != 0){ //if it is not a zero, i.e. it has already been inputted
    checkEntered6(button); //move on to checkEntered4, passing it "button"
  }
  
  else if (entered[4] == 0){ //if it is zero, i.e. if it hasn't been defined with a button yet
    entered[4] = button; //set the third element as the button that has been pressed
    Serial.print("5: ");Serial.println(entered[4]); //for debugging
  }
  
}

void checkEntered6(int button){ //check the fourth element of the entered[] array
//  digitalWrite(LED[button-1],HIGH);
  if (entered[5] == 0){ //if it is zero, i.e. if it hasn't been defined with a button yet
    entered[5] = button; //set the final element as the button that has been pressed
    Serial.print("6: ");Serial.println(entered[5]); //for debugging
    delay(100); //allow time for processing
    compareCode(); //call the compareCode function
  }
}

void compareCode(){ //checks if the code entered is correct by comparing the code[] array with the entered[] array
  for (int i = 0; i<6;i++){ //these three lines are for debugging
    Serial.println(entered[i]);
  }
  if ((entered[0]==code[0]) && (entered[1]==code[1]) && (entered[2]==code[2]) && (entered[3]==code[3]) && (entered[4]==code[4])&& (entered[5]==code[5])){ //if all the elements of each array are equal
//    digitalWrite(Red, LOW); // turn the red LED off
//    digitalWrite(greenLed, HIGH); //turn the green LED on
    delay(1000); //wait for a bit
//    digitalWrite(greenLed, LOW); //turn the green LED off


    
    for (int i = 0; i < 7; i++){ //this next loop is for debugging
      entered[i] = 0;
      
    }
   
    loop(); //return to loop() (not really necessary)
  }
  
  else { //if you (or the intruder) get the code wrong
    
//    digitalWrite(Red,HIGH);
    delay(1000);
//    digitalWrite(Red,LOW);
    Serial.println("Red OFF");
    for (int i = 0; i < 7; i++){ //this next loop is for debugging
      entered[i] = 0;
     
    }
    
  }
  close_all();
}



void close_all(){
//digitalWrite(LED[0],LOW);
//digitalWrite(LED[1],LOW);
//digitalWrite(LED[2],LOW);
//digitalWrite(LED[3],LOW);
//digitalWrite(LED[4],LOW);
//digitalWrite(LED[5],LOW);
}

Yeah, it is not a 10min job! It will take the hours required to find out your exact requirements and hardware, make the code, test the code and you are also paying for the time spent by the coder to learn how to code. Anything worth something costs something. Things that cost nothing are worth nothing.

1 Like

It didn't take 10 minutes to learn to code that in 10 minutes though, did it?

2 Likes

ok fine ill do it myself, noone helpful on this forum. I know enough coding in reprap to know this is an easy 10 minute code, it will just take me a couple weeks to learn a new language.

If you needed voluntary help, you should have gone ahead and posted what code you have written till now. A lot of people would have been more than willing to help.

But you clearly said you need paid help and the Moderators moved this post to this section.

For someone who claims to know something is "an easy 10 minute code" should also be capable to write the code himself without others help.

Please go ahead, we'll be here and glad to see how you achieve this feat in a "couple of weeks".

1 Like

It is easy code, yes. Many here could write it in 10 minutes but it wouldn’t do you any good. The code would work fine but without a detailed discussion about what it has to interact with and the requirements of such it would just be an isolated component of a project that doesn’t work. Perhaps when looking for help you should try not to denigrate the people that can provide it by suggesting their value is minimal. If people are good enough at doing something to do it fast then they deserve suitable remuneration. Your time is obviously worth less as you will now spend weeks of it to achieve what you only value at 10mins for a coder.

We understand the hurry.

If you don't know how to program, as you say, I'm not sure how you would know the amount of time it will take...

Anyway, at current rates around this area $150/hour = $2.5/minute so we'd be looking at $25. However, this is not a 10 minute job -- there's really no such thing as a 10-minute job, just go ask your friendly neighborhood auto mechanic who charges around $110/hour.

Questions we'd need to ask are:

  1. Are there security requirements to consider. It's a vending machine, is this a way to access the money, or the back panel or to get free stuff so we will expect that people will try to cheat the system.
  2. How do you want to be able to update the access code if you need to change it?
  3. Do you need any kind of "lockout?" i.e, if someone fails to get the right code in 1 minute, should the system disable itself permanently? Disable for 10 minutes? Anything like that?
  4. What would happen if the attacker got access to the unlock signal? Not a programming problem, but from a system design perspective it would be unprofessional of me to not ask.

I think it took me about 10 minutes to write this post...

1 Like

Just the exchanging of "requirements" in ping-pong emails to lock down the prototype design will take 10 - 15 minutes per email and probably 3 or 4 cycles to reach a mutual understanding. What is the agreed completion phase... one payment, or a partial payment when prototype is shown in video conference? If you do not understand the term "scope creep" then Google it.

Then there is that 12 Volt thing? What is behind that requirement, a solenoid? Brand and link? Is backup power a requirement ... might be useful if this is a gun safe.

Expectation of short turnaround is always laughable unless your coder is your next door neighbor.

Commercial options are available:

no and never. if you have problems with your code tell us with the part of code(variables and lines that is for problem thing) you can merge circuits or use other arduino (if you need another uno like me)

Also finding people would be really hard so always write yourself, dont pay to P2C arduino designed to you write the code

And what the hell this doing on zero forum isnt it UNO r3

This is clearly a school assignment.

You have a certain material available:

  1. a Uno
  2. a 12 volt power supply
  3. a 4 relay module shield
  4. miscellaneous unspecified hardware including buttons

Your objective is to build a model of a vending machine which needs a 6 (binary?) digit password to activate it.
Will a simulation be sufficient, for example https://wokwi.com/, or do you have to build a physical model ?

???