Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
23
Task/Active-object/BBC-BASIC/active-object.basic
Normal file
23
Task/Active-object/BBC-BASIC/active-object.basic
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
INSTALL @lib$+"CLASSLIB"
|
||||
INSTALL @lib$+"TIMERLIB"
|
||||
INSTALL @lib$+"NOWAIT"
|
||||
|
||||
REM Integrator class:
|
||||
DIM integ{f$, t#, v#, tid%, @init, @@exit, input, output, tick}
|
||||
PROC_class(integ{})
|
||||
|
||||
REM Methods:
|
||||
DEF integ.@init integ.f$ = "0" : integ.tid% = FN_ontimer(10, PROC(integ.tick), 1) : ENDPROC
|
||||
DEF integ.@@exit PROC_killtimer(integ.tid%) : ENDPROC
|
||||
DEF integ.input (f$) integ.f$ = f$ : ENDPROC
|
||||
DEF integ.output = integ.v#
|
||||
DEF integ.tick integ.t# += 0.01 : integ.v# += EVAL(integ.f$) : ENDPROC
|
||||
|
||||
REM Test:
|
||||
PROC_new(myinteg{}, integ{})
|
||||
PROC(myinteg.input) ("SIN(2*PI*0.5*myinteg.t#)")
|
||||
PROCwait(200)
|
||||
PROC(myinteg.input) ("0")
|
||||
PROCwait(50)
|
||||
PRINT "Final value = " FN(myinteg.output)
|
||||
PROC_discard(myinteg{})
|
||||
Loading…
Add table
Add a link
Reference in a new issue