You probably want to apply power to unlock, otherwise it will unlock on a power failure.
Anyway, I have an implementation of the idea. It uses an LED to indicate the status of the lock, but that should be easy to change. Shall I make a poll to see what the community think it is worth?
man you guys really make things more complicated than it is lol no wonder your able to charge people so much. I dont need to exchange emails back and forth about hardware requirements etc .
Yes I have already figured out the fail safe issues and the backup power issues. the hardware is already installed, just needed a quick and dirty code to get a combination to send out a signal, then another combination to turn off that signal is all.
I have everything figured out as far as hardware and every other detail every one keeps quoting they would need to know to draw out the process for weeks so they can charge someone $130/hr or whatever. Im very knowledgeable in a lot of stuff and have done more custom fabrication in multiple different disciplines than most will in a lifetime.
Im sorry I asked, I will sort it out over the next few days, life is just hectic right now and hoped someone was able to help with a basic code to get started for now and work on it from there. Thanks for all your inciteful wisdom
Since @57buick has now decided they are not interested in offering payment in exchange for the code, I have moved this back out of the "Jobs and Paid Consultancy" forum category.
It appears @57buick has created another topic about hardware aspects of the project here:
@57buick it is OK to create multiple topics about a project as long as they are about distinct subjects. However, if you are going to do that you must be careful not to allow the two to converge into parallel discussions as they have a tendency to do.
It is also polite to add cross-links between the two topics so that the helpers will have access to any useful context the other topic might provide.
yes the other topic I started was nothing to do with coding, it was specifically verifying the hardware abilities as I continue the coding process. I am in talks now with a coder thru email to do some code for me at reasonable price for the short amount of time this code obviously would take.
Just thought that several people were being snippy and wanting to make things way more complicated than it needed to be as if I didnt know about other requirments for myu own system.
I wasnt asking someone to design a whole system for me. I already have that mostly installed and figured out. Just needed a simple code when I punch a combination it sends out a signal, thats it. I can build and design the rest easily myself
I suppose a professional developer might also have thrown in a lambda expression, a templated class, some direct port manipulation and a copyright notice for a paid job.
Even if someone was able to code what the OP need. The coder will need ... what type of hardware is connect in order to do a proper code. Someone can do a small breadboard circuit with switches and leds, and do a combination 6 digit and turn a led. You can do with a keypad or a series of push buttons. Code for a keypad system will be different that a series of push buttons system. And the moment you upload the code, it may not work as intended due to the hardware.
I can simply create a code for you (but I need some time, I am very busy at the moment)...
Can you tell me how the 6 buttons are electrically wired on your vending machine ?
that is to say : does each button has 2 independent electric wires ?
If not, will you be able to wire 6 switches to connect to your UNO, and put these switches in a mechanical box ?
Yes, it would be better to use a shield of at least 2 relays (the UNO could be enough, but for electrical safety, it is better to use a relay shield).
honestly I am curious about the working code...if you haven't paied for it could be possible share with us?...maybe your code can help someone else in the future.
thanks
a user submitted this mod of the code I had which definitely cleaned up my code a lot better and did exactly what I needed.
const int ButtonCount = 6;
const byte ButtonPins[ButtonCount] = {2, 3, 4, 5, 6, 7}; //first button is on pin 2
const int greenLed = 9; //green LED is pin 9
int TurnOnCode[] = {6, 5, 5, 4, 3, 2};
const int TurnOnCodeCount = sizeof TurnOnCode / sizeof TurnOnCode[0];
int TurnOnCorrectCount = 0; // How many have been entered
int TurnOffCode[] = {1, 1, 1};
const int TurnOffCodeCount = sizeof TurnOffCode / sizeof TurnOffCode[0];
int TurnOffCorrectCount = 0; // How many have been entered
void setup() //run once at sketch startup
{
Serial.begin(9600); //begin Serial
for (int i = 0; i < ButtonCount; i++)
pinMode(ButtonPins[i], INPUT_PULLUP);
pinMode(greenLed, OUTPUT); // the green LED is an output
Serial.print("Turn On code: ");
for (int i = 0; i < TurnOnCodeCount; i++)
{
Serial.print(TurnOnCode[i]); //print each digit of the code
}
Serial.println();
Serial.print("Turn Off code: ");
for (int i = 0; i < TurnOffCodeCount; i++)
{
Serial.print(TurnOffCode[i]); //print each digit of the code
}
Serial.println();
}
void loop() //run repeatedly
{
// Check each button
for (int i = 0; i < ButtonCount; i++)
{
if (digitalRead(ButtonPins[i]) == LOW) //if button is pressed
{
// Button is pressed
checkEntered(i + 1); //call checkEntered and pass it the button number
delay(250); //wait, needed for correct functioning, otherwise
//buttons are deemed to be pressed more than once
}
}
}
void checkEntered(int button) //check the button press
{
// Check against turn-on code
if (button == TurnOnCode[TurnOnCorrectCount])
{
TurnOnCorrectCount++;
if (TurnOnCorrectCount == TurnOnCodeCount)
{
// Success!
digitalWrite(greenLed, HIGH); //turn the green LED on
// Start over
TurnOnCorrectCount = 0;
}
}
else // Not the correct button
{
TurnOnCorrectCount = 0; // Start over
}
// Check against turn-off code
if (button == TurnOffCode[TurnOffCorrectCount])
{
TurnOffCorrectCount++;
if (TurnOffCorrectCount == TurnOffCodeCount)
{
// Success!
digitalWrite(greenLed, LOW); //turn the green LED off
// Start over
TurnOffCorrectCount = 0;
}
}
else // Not the correct button
{
TurnOffCorrectCount = 0; // Start over
}
}