DS1302 add ons
I'm looking for routines to add a scheduler and control buttons to the DS1302_full object. I want to be able to use the buttons to set the time and date without a PC interface. I looked through the OBEX and did not find anything that looked like it would work. Anybody have any suggestions?

Comments
Here's how I use the button. This loop is in cog 0, as all the work is being done in other cogs...
repeat ' loop if ina[BUTTON] ' ├─ if button pressed waitcnt((clkfreq / 16) + cnt) ' │ ├─ short delay to help debounce ' │ │ if ina[BUTTON] ' │ └─ button still pressed? settingRTC := TRUE ' │ └─ set the indicator flag ' │ waitcnt((clkfreq / 10) + cnt) ' └─ wait 0.1 secondsMy various cog methods check the flag 'settingRTC' to see if they should alter their behavior. For instance, the 'clock' cog:
PUB cog_Clock | t ''* initializes and reads the RTC ''* updates the global time variables every 1 sec '' ' == cog initialization == rtc.RTCEngineStart(RTC_DATA, RTC_CLOCK, -1) ' start the clock object waitcnt((clkfreq * 2) + cnt) ' wait 2 seconds t := cnt ' == cog loop == repeat ' loop ifnot settingRTC ' └─ if normal operation rtc.readTime ' ├─ get current time ' │ hour := rtc.clockHour ' ├─ update the hub time values minute := rtc.clockMinute ' │ second := rtc.clockSecond ' │ day := rtc.clockDate ' │ month := rtc.clockMonth ' │ year := rtc.clockYear ' │ dow := rtc.clockDay ' │ waitcnt(t += clkfreq) ' ├─ update every second ' │ else ' else we're setting the date/time setTimeButton ' ├─ so call function to set the date/time Comms.str(LCD, String("?f")) ' ├─ clear the LCD screen waitcnt((clkfreq / 20) + cnt) ' ├─ short delay after screen clear settingRTC := FALSE ' ├─ reset the flag t := cnt ' ├─ keep the count going waitcnt(t += clkfreq) ' └─ update 't' for one second delayother cogs test for the flag similarly. And these two functions tie it up. I think you'll find the object (beau1button) is well documented and easy to understand.
PRI beau1button(buttonPin, strPtr, varSet, loLim, hiLim) | tmp ' 1-button user input routine as suggested by Beau: ' http://forums.parallax.com/showthread.php?p=921531 ' '* press and release to increment digit '* press and hold to increment field 'buttonPin = input button pin number 'strPtr = pointer to message string output to line 1 of LCD 'varSet = variable to be set (determines initial setting 'loLim = lower limit of variable range 'hi Lim = high limit of variable range '* set up to work with a single pushbutton switch connected to the buttonPin with a pulldown '* outputs to LCD ' ' 220Ω ' +3.3v ─[button]──┳──── buttonPin ' │ ' 10KΩ '  ' gnd ' waitpeq(0, |< buttonPin, 0) 'wait for button release repeat 'loop Comms.str(LCD, String("?f")) '├─ clear screen Comms.str(LCD, strPtr) '├─ display the prompt Comms.str(LCD, String("?y1")) '├─ move to the first line Comms.str(LCD, String("?x00")) '├─ move to first column Comms.str(LCD, SimplNum.decx(varSet, 2)) '├─ display the variable '│ waitpeq(|< buttonPin, |< buttonPin, 0) '├─ wait for button press tmp := cnt '├─ copy the counter value waitcnt((clkfreq / 20) + cnt) '├─ short delay to help debounce waitpne(|< buttonPin, |< buttonPin, 0) '├─ wait for button release '│ if (cnt - tmp) > INCR_MENU '├─ button held down > 1 sec? return varSet '│ └─ yes, return value else '├─ otherwise varSet++ '│ └─ no, increment value '│ if varSet > hiLim '├─ if top of list varSet := loLim '│ └─ start over at bottom of list '│ waitcnt((clkfreq / 5) + cnt) '└─ short pause to help debounce { =============================================================================== } PRI setTimeButton 'routine to set day/time using a single button 'has to be called from cog_Clock (for access to rtc) repeat until not lockset(lockData) ' lock the access dow := beau1Button(BUTTON, @dowStr, dow, 1, 7) day := beau1Button(BUTTON, @dayStr, day, 1, 31) month := beau1Button(BUTTON, @monthStr, month, 1, 12) year := beau1Button(BUTTON, @yearStr, year, 11, 26) hour := beau1Button(BUTTON, @hourStr, hour, 0, 23) minute := beau1Button(BUTTON, @minuteStr, minute, 0, 59) second := 0 second := beau1Button(BUTTON, @secondStr, second, 0, 59) year := year + 2000 ' fill out the year rtc.writeTime(second, minute, hour, dow, day, month, year) waitcnt((clkfreq / 4) + cnt) lockclr(lockData) ' unlock DAT FileHeader byte "Date,Time,Upstairs (F),Humidity (%),Downstairs (F),Outside (F),Humidity (%)", 13, 0 dowStr byte "Set Day (Sun=1)", 0 'prompt strings used in setting RTC dayStr byte "Set Date", 0 monthStr byte "Set Month", 0 yearStr byte "Set Year", 0 hourStr byte "Set Hour", 0 minuteStr byte "Set Minute", 0 secondStr byte "Set Second", 0If you would like to see a bit more about my project using a PCA9555 bus extender, check out my post in the next few weeks as I will be posting a new update. http://forums.parallax.com/showthread.php?134537-PPDB-Using-the-full-PPDB-Code-Version-1.3 .