ejota

I'm working on a pet treat dispenser that will enable someone to click a web submit button and activate the dispenser for one cycle. Ideally, I'd like the submit button to be disabled globally to the web (so my pets can't get more than one treat per 15 minutes) along with a countdown timer until the button is again enabled. I've gotten everything sorted out and ready to go except for a button that will do what I want it to.

Right now I have a web submit button that activates the feeder and resets, but can't figure out how to disable it with delay and display contdown either on the button or back to the webpage. And, I'm not sure exactly how this will need to be done other than it will probably need done with ajax/javascript or perhaps boolean logic. I don't think adding a 15 minute delay would be a good idea with an ethernet connection, but maybe I'm wrong. I'm fairly new to all of this, so any help you can give would be awesome.

To summarize, what I'd like is:

A web submit button that disables globally for 15 minutes after click and displays a message and/or a countdown timer until it enables itself again.

//in your main loop:if (millis()-ulTimeStamp >= 1000) {ulTimeStamp = millis();//do something every second:if ( bState == cbState_locked ) {if ( wRemainingTime > 0 ) {wRemainingTime = wRemainingTime - 1;} else {// time is over - pets are allowed to get some thing..bState = cbState_free;}}}hey - this is just a dirty hack free out of my mind - i hope it helps to get a idea how to go for this.

if you want to see the count down counting on the webside - you need javascript!the concept at this part would be to get the webside with the remaining time and a small javascript that counts down this time.and if it is reaching 0 it just reloads the page. i have set up a small example: http://jsfiddle.net/s_light/eZ8DJ/2/have fun sunny greetings stefan

ejota

I'm going to work on this over the next couple days and will post back with my updated code. Currently my button is using javascript and showing the countdown correctly, but a page refresh or another user accessing the page would see the "feed" button again and not the countdown. Just ignoring requests won't solve the problem with the button code. As such, I need to go a different route since it won't function like I want, so I'll give s-light's suggestion a try.