[comp.sys.tandy] Power on/off function in Tandy 200 Basic?

tswift@well.sf.ca.us (Theodore John Swift) (05/16/91)

I have a problem that y'all with Tandy 200s or Model 102s can help me with.
There's a Power function in Tandy Basic, which, if given a numeric expression:

POWER numeric expression

sets the dwell before the M200 goes to sleep.  Given arguments for time and 
date:

POWER "hh:mm:ss","mm/dd/yy", BASIC program

Power will tell the clock chip to set an alarm to wake everyone up at the given
time and date, and will do some cool things:
* If the power is on and your are at the main menu, Basic beeps and runs
  the named program.
* If the power is on and you're not in the main menu, Basic beeps and
  prompts you to run the program.
* If the power is off and was turned off manually, Basic beeps, stokes the
  boilers, and runs the program.
* If the power is off and was turned off automatically, Basic beeps, turns
  power on, then prompts you to run the program.  If you don't do anything
  for 40 seconds, Basic shuts down the show again.

I want the M200 to wake up every 5 minutes, do some stuff like read some 
voltages from the ADC-812 board (which I bought from Rural Engineering, a 
pretty spiffy little product in itself), store them in a file, and go back to 
sleep to save power.  But the POWER function doesn't seem to like a variable in
the argument for the wake up call: I get a syntax error when I do this:

1 'program foo.ba to try out the power function
10 FOR I = 35 TO 45 STEP 5 'try it every 5 minutes
20 POWER "19:I:00", "05/14/91", FOO.BA 'this being 7:30 on tuesday 14 May
30 PRINT "GOOD MORNING" 40 POWER 10 'go back to sleep in a minute
50 NEXT I

Now, ignoring the probably errors in the For-Next loop and other random 
weirdness,  I get a syntax error on line 20.  Adding confusion to injury, if I 
replace the I with something reasonable, like "POWER "19:45:00",etc., I get a 
type mismatch error.  Grrr!.  Any thoughts?  Thanks
-- 
----------------------
Ted Swift tswift@well.sf.ca.us
"You bally well are informed, Jeeves!  Do you know everything?"
"I don't know, sir"    ~P.G. Wodehouse

cameronjames@snoc01.enet.dec.com (James Cameron) (05/17/91)

In article <24800@well.sf.ca.us>, tswift@well.sf.ca.us (Theodore John Swift) writes:
>POWER "hh:mm:ss","mm/dd/yy", BASIC program
>
>20 POWER "19:I:00", "05/14/91", FOO.BA 'this being 7:30 on tuesday 14 May

Ted,

Try POWER "19:"+RIGHT$(STR$(I+100),2)+":00","05/14/91",FOO.BA

And if that doesn't work, consider

    1) priming the type-ahead buffer with a command that you build.  See CHANGE.BA in the
        Tandy 100 archives for a fragment of code to do this.

    2) writing a text file containing
	10 POWER etc
        then execute the text file by RUN"filename.DO".

    3) giving up and buying some NiCd cells and a small solar panel.

--
James Cameron
Digital Equipment Corporation (Australia) P/L
(cameronjames@snoc01.enet.dec.com)

tswift@well.sf.ca.us (Theodore John Swift) (05/21/91)

I had this problem with the POWER function in Tandy 200 BASIC:
(crucial details deleted)
> >POWER "hh:mm:ss","mm/dd/yy", "BASIC program"
> >20 POWER "19:I:00", "05/14/91", FOO.BA 'this being 7:30 on tuesday 14 May

then cameronjames@snoc01.enet.dec.com (James Cameron) suggested:

> Ted,
> Try POWER "19:"+RIGHT$(STR$(I+100),2)+":00","05/14/91",FOO.BA

and, hot damn: it worked!  Or at least, it ran and beeped.  Thanks, James!
The crucial part was to add the RIGHT$(string,2) part.  I had tried simply

      POWER "19:"+STR$(I)+":00","05/14/91", FOO.BA

which doesn't work.  I also found that it was important to make it "FOO.BA",
in quotes, since POWER is looking for a string.  Now we'll see if it can be
made to happen repetatively under program control.  Stay tuned.
-- 
----------------------
Ted Swift tswift@well.sf.ca.us
"You bally well are informed, Jeeves!  Do you know everything?"
"I don't know, sir"    ~P.G. Wodehouse