You can solve this with an Arduino:illuminating wrote:Hey whomadeangus.whomadeangus wrote:I would pay money for that set up. Something that was plug and play… I wonder if it could be set up to do other things like let it play songs from a list that you hate or play on a screen a movie you hateilluminating wrote:I once wrote a program like that. (without the VR part that is)
The program chooses a (blind) random time to count down. (between preset min & max)
The program has only one button.
If you press it after the countdown has ended it opens the CD-tray, releasing the key.
If you press it before the countdown has ended the timer resets.
An alternative setup is when the timer is visible and counting down (in one or two minutes)
from the absolute maximum lockdown time you think you might be able to handle, to the minimum time you want to be locked down.
You can press the button once the timer gets to a lockdown time you know you will be able to handle.
But if you wait too long (hoping to get away easy) and get below a random chosen lock down time (between min and max),
the timer resets to the max.
..and the button is deactivated.
I would love to send them to you, however, to be honest, I'm not a very good programmer and while I am willing to face the consequences of my own software-bugs I would not want anyone else to suffer them.
Apart from that, I wrote them years ago. They worked under Xp, not sure how they do on newer platforms.
Let me know If you would like to get in contact to see what works and what not.
With the code from File/Examples/02.Digital/Debounce where you change the Led (ledPen) with a magnet (magnetPen) at 5V that hold the key away from you.
And with the functions:
randomSeed(AnalogRead(0)); // to make it random with reading from a port with nothing on it.
randomTime=random(minimumTime, maximumTime+1); // minimum and maximum time in seconds, no longer than 49 days
And
unsigned long millisRandomTime = millis() + randomTime * 1000;
unsigned long millisMaximumTime = millis() + maximumTime * 1000;
Instead of the digitalWrite(ledPin, buttonState); // when the button is pressed
comes the if-statement:
If (millis()<millisRandomTime) {
millisRandomTime=millisMaximumTime; // if you press the button before random time then
// you must wait to the maximum time
}
else {
digitalWrite(magnetPen, LOW); //No reason to put it back on HIGH, so instead of buttonState put it on LOW
}
The alternative setup where you can see the time can be solved in much the same way.