OpenBCM V1.08-5-g2f4a (Linux)

Packet Radio Mailbox

IZ3LSV

[San Dona' di P. JN]

 Login: GUEST





  
PA3BNX > SOFT     13.02.08 13:01l 984 Lines 17610 Bytes #999 (0) @ WW
BID : 52220_PI8OSS
Read: GUEST
Subj: FT840 basic cat controlprog.
Path: IZ3LSV<IW2OHX<I0TVL<IK2XDE<DB0RES<ON0AR<PI8ZAA<PI8OSS
Sent: 080212/1139Z @:PI8OSS.#NBO.NLD.EU #:52220 [Oss] #:183292 $:52220_PI8OSS
From: PA3BNX@PI8OSS.#NBO.NLD.EU
To  : SOFT@WW

Hello all out there,

Here my latest source in QuickBasic catcontrol program for the ft840 Yeasu
With Joystick control on a db15 connector.
Have fun......
-----------------------------------------
DECLARE SUB joystick ()
DECLARE FUNCTION Detectjoystick! ()
DECLARE SUB savecfg (datas AS STRING)
DECLARE SUB loadcfg ()
DECLARE FUNCTION length$ (myval AS STRING, x AS INTEGER)
DECLARE SUB deleteline (yPosition AS INTEGER, xPosition AS INTEGER)
DECLARE FUNCTION collect$ (mykey AS STRING, clearing AS INTEGER)
DECLARE SUB setfreqft840 (freq AS STRING)
DECLARE SUB basicscreen ()
DECLARE SUB adjustfreqency ()
DECLARE SUB datumtyd ()
DECLARE SUB speed ()
DECLARE SUB delay ()
DECLARE SUB commandline (myval AS STRING)
DECLARE SUB turnprompt ()
DECLARE SUB Signaalmeter ()
DECLARE SUB getfreqft840 ()
DECLARE SUB conversieSmeter ()
DECLARE FUNCTION inkeyen$ ()
DECLARE SUB main ()
DECLARE SUB stripe ()
DECLARE FUNCTION center% (myval AS STRING)
DECLARE FUNCTION error$ (fout AS INTEGER)
DECLARE SUB functionkey ()

'Integer
DIM SHARED ypos AS INTEGER, xpos AS INTEGER
DIM SHARED endprog AS INTEGER
DIM SHARED xFunction AS INTEGER
DIM SHARED flagFunctieToets AS INTEGER
DIM SHARED port AS INTEGER
DIM SHARED cfgflag AS INTEGER
DIM SHARED nbr AS INTEGER 'Sequentieel filenumber
DIM SHARED bjoy AS INTEGER, xjoy AS INTEGER, yjoy AS INTEGER
DIM SHARED va AS LONG

'Float
DIM SHARED v AS SINGLE
DIM SHARED freq AS INTEGER

'String
CLEAR
start:

''Arrays
DIM SHARED binsmeter840(0 TO 255) AS INTEGER
DIM SHARED freq840(1 TO 19) AS INTEGER
DIM SHARED smeter(1 TO 15) AS STRING
'Const
CONST ve$ = "Version 1.07"
CONST cfg$ = ".\ft840.cfg"
CONST khz$ = "kHz"

'================================================================
'Demonstration program in QB  4.5 for catcontrol i/o put
'Read/write to the Yaesu FT840 from PA3BNX Lodewijk at Rhenen.
'================================================================
'Updated @05-11-2007
'Updated @17-12-2007
'Updated @23-12-2007
'Updated @28-01-2008
'Some default params
ypos = 14  'Line where freqft840
v = .45

ON ERROR GOTO 500
'-----------Program---------
CALL main
SYSTEM
'-----------Error$-----------

500
 IF cfgflag > 0 THEN
  CALL savecfg("1") 'Default comport 1
   cfgflag = 0
  RUN
 END IF
 CLS
 CALL stripe
 PRINT error$(ERR)
 CALL stripe
 SYSTEM

SUB adjustfreqency
'Integer
DIM ypos1 AS INTEGER
DIM xpos1 AS INTEGER

'Const
CONST cur$ = "_"
'String
DIM mytxt AS STRING
DIM myval AS STRING
DIM myval1 AS STRING
DIM myvalold AS STRING

COLOR 15

'Banner
mytxt = "Give the frequence in max 5 digits "

'New location
ypos1 = ypos + 2
xpos = 10
xpos1 = xpos + LEN(mytxt)


upper:

'' Line,Space
LOCATE ypos1, xpos
PRINT mytxt + cur

myvalold = collect("", 1) 'Reset collector
 
  DO
   myval = inkeyen            'Last typed char
   myval1 = collect(myval, 0) 'Collected chars
  
   IF LEN(myval1) <> LEN(myvalold) THEN
    CALL deleteline(ypos1, xpos1)
    PRINT myval1 + cur
   END IF
  
   myvalold = myval1
  LOOP UNTIL myval = CHR$(13) OR myval = CHR$(27)

  myvalold = collect("", 1) 'Reset the collector

  IF myval = CHR$(27) THEN
   CALL deleteline(ypos1, 1)
   EXIT SUB
  END IF
  
  IF LEN(myval1) < 7 AND VAL(myval1) >= 100 AND VAL(myval1) <= 30000 THEN
   myval = LEFT$(myval1, LEN(myval1) - 1)''Enter strippen
    'Op maat maken in 5 digits
      myval = length(myval1, 5)
     ELSE
      myval = collect("", 1) 'Clear collect
      CALL deleteline(ypos1, xpos1)
      GOTO upper
  END IF

 CALL deleteline(ypos1, 1)
 CALL setfreqft840(myval)
 

END SUB

SUB basicscreen
'Integer
''String
DIM myval AS STRING

CLS
COLOR 12
myval = " ((C)PA3BNX Yaesu cat control FT840 on com" + LTRIM$(STR$(port)) + "."
LOCATE 1, 1
PRINT myval
LOCATE 1, 80 - LEN(ve$)
PRINT ve

IF port = 1 THEN
 COLOR 11
 myval = "Start FT840.exe with FT840.exe 2 for compoort 2 !"
 LOCATE 2, center(myval)
 PRINT myval
END IF
IF bjoy = 1 THEN
 LOCATE 1, 50
 PRINT "JoyStick ";
 COLOR 15
 PRINT "1 " + khz$
END IF

COLOR 14

CALL stripe

COLOR 12
myval = "Cmd's> F1(Type),F2,F3,F4,F5,F6,F7,F8,F9,F10,F12,Z,Q>"
LOCATE 23, center(myval)
PRINT myval

COLOR 14
LOCATE 22, 1
CALL stripe


END SUB

FUNCTION center% (myval AS STRING)

 center = 40 - LEN(myval) \ 2

END FUNCTION

FUNCTION collect$ (mykey AS STRING, clearing AS INTEGER)
'ToDo
'Collect the inkeyed strings.
'Clear function by setting clearing to 1

'String
STATIC myval AS STRING

IF clearing > 0 THEN myval = ""
IF mykey = "" THEN
 collect$ = myval
 EXIT FUNCTION
END IF

''Some filtering

SELECT CASE mykey
 CASE CHR$(8)
  IF LEN(myval) > 0 THEN
   myval = LEFT$(myval, LEN(myval) - 1)
  END IF
 CASE CHR$(10)'cr
 CASE CHR$(13)'lf
 CASE CHR$(27) 'Esc
 CASE ELSE
  myval = myval + mykey
END SELECT


collect$ = myval

END FUNCTION

SUB commandline (myval AS STRING)

IF INSTR(1, myval, "?") THEN
 CLS
 PRINT ve$ + CHR$(10) + CHR$(13) + "Use ft840.exe 1 or ft840.exe 2 or ft840.exe ?"
 SYSTEM
END IF

CALL loadcfg

IF port > 0 AND myval = "" THEN
 EXIT SUB
END IF

IF myval = "" OR myval = "1" THEN
 port = 1
  ELSE
 port = 2
END IF

CALL savecfg(STR$(port))

END SUB

SUB conversieSmeter
smeter(1) = "S1"
smeter(2) = "S2"
smeter(3) = "S3"
smeter(4) = "S4"
smeter(5) = "S5"
smeter(6) = "S6"
smeter(7) = "S7"
smeter(8) = "S8"
smeter(9) = "S9"
smeter(10) = "S9 + 10dB"
smeter(11) = "S9 + 20dB"
smeter(12) = "S9 + 30dB"
smeter(13) = "S9 + 40dB"
smeter(14) = "s9 + 50dB"
smeter(15) = "S9 + 60dB"



END SUB

SUB datumtyd
'ToDo
'Print date and time on screen

'String
DIM myval AS STRING
DIM myval1 AS STRING

myval = DATE$
myval1 = MID$(myval, 4, 3) + LEFT$(myval, 2) + RIGHT$(myval, 5)
myval = "Date " + myval1 + SPACE$(1) + "Time " + TIME$

COLOR 15, 1
LOCATE 22, center(myval)
PRINT myval
COLOR 15, 0

END SUB

SUB delay
'Float
DIM x AS SINGLE
'String
DIM myval AS STRING

IF endprog = 1 THEN EXIT SUB

myval = collect(inkeyen, 0)

FOR x = 1 TO v * va
  myval = TIME$
NEXT x

END SUB

SUB deleteline (yPosition AS INTEGER, xPosition AS INTEGER)
'ToDo
'Delete a line on yposition at xposition
'Integer
DIM x AS INTEGER

'Line,Spation
x = 81 - xPosition
''locate Line, Space
LOCATE yPosition, xPosition
PRINT SPACE$(x)
LOCATE yPosition, xPosition

END SUB

FUNCTION Detectjoystick!
''ToDo
''@26-01-2008
''Detect a joystick1 db15 connector
''If x and y axis are 0 then assume there is no joystick connected

xjoy = STICK(0)
yjoy = STICK(1)

IF xjoy > 0 AND yjoy > 0 THEN
 Detectjoystick = 1
  ELSE
 Detectjoystick = 0
END IF

END FUNCTION

FUNCTION error$ (fout AS INTEGER)
REM Alle Qbasic fout meldingen.
'==============================

SELECT CASE fout
CASE 1
 error$ = "Next without FOR"
CASE 2
 error$ = "Syntax error$"
CASE 3
 error$ = "RETURN without GOSUB"
CASE 4
 error$ = "OUT of DATA"
CASE 5
 error$ = "illegal function call"
CASE 6
 error$ = "OVERFLOW"
CASE 7
 error$ = "OUT of memory"
CASE 8
 error$ = "Undefined line number"
CASE 9
 error$ = "Sunscribt out of range"
CASE 10
 error$ = "Duplicate definition"
CASE 11
 error$ = "Division by zero"
CASE 12
 error$ = "illegal direct"
CASE 13
 error$ = "Type mismatch"
CASE 14
 error$ = "Out of string space"
CASE 15
 error$ = "String too long"
CASE 16
 error$ = "String formula too complex"
CASE 17
 error$ = "Can't continue"
CASE 18
 error$ = "Udefined user function"
CASE 19
 error$ = "No Resume"
CASE 20
 error$ = "Resume without error$"
CASE 22
 error$ = "Missing operand"
CASE 23
 error$ = "Line buffer overflow"
CASE 24
 error$ = "Device time out"
CASE 25
 error$ = "Device fault"
CASE 26
 error$ = "FOR without NEXT"
CASE 27
 error$ = "Out of paper"
CASE 29
 error$ = "WHILE without WEND"
CASE 39
 error$ = "CASE ELSE expected"
CASE 40
 error$ = "Variable required"
CASE 50
 error$ = "Field overflow"
CASE 51
 error$ = "Internal error$"
CASE 52
 error$ = "Bad file number"
CASE 53
 error$ = "File not found"
CASE 54
 error$ = "Bad file mode"
CASE 55
 error$ = "File already open"
CASE 57
 error$ = "Device I/O error$"
CASE 58
 error$ = "File already exist"
CASE 59
 error$ = "Bad record length"
CASE 61
 error$ = "Disk full"
CASE 62
 error$ = "Input past end"
CASE 63
 error$ = "Bad record number"
CASE 64
 error$ = "Bad file name"
CASE 66
 error$ = "Direct statement in file"
CASE 67
 error$ = "Too many files"
CASE 68
 error$ = "Device unavailable"
CASE 69
 error$ = "Communication buffer overflow"
CASE 70
 error$ = "Disk write protected"
CASE 71
 error$ = "Drive not ready"
CASE 72
 error$ = "Disk media error$"
CASE 73
 error$ = "Future unavailable"
CASE 74
 error$ = "RENAME across disk"
CASE 75
 error$ = "Path/File acces error$"
CASE 76
 error$ = "Path not found"
CASE ELSE
 error$ = "Not found an error$ message."
END SELECT



END FUNCTION

SUB functionkey
'String
DIM myval AS STRING

IF flagFunctieToets = 0 THEN
 EXIT SUB
  ELSE
 flagFunctieToets = 0
END IF

'F1 t/m F12

COM(port) ON

SELECT CASE xFunction
 CASE 59
  CALL adjustfreqency
 CASE 60
  PRINT #nbr, CHR$(&H0); CHR$(&H3); CHR$(&H6); CHR$(&H0); CHR$(&HA)
 CASE 61
  PRINT #nbr, CHR$(&H0); CHR$(&H91); CHR$(&H8); CHR$(&H0); CHR$(&HA)
 CASE 62
  PRINT #nbr, CHR$(&H0); CHR$(&H42); CHR$(&H12); CHR$(&H0); CHR$(&HA)
 CASE 63
  PRINT #nbr, CHR$(&H0); CHR$(&H40); CHR$(&H5); CHR$(&H0); CHR$(&HA)
 CASE 64
  PRINT #nbr, CHR$(&H0); CHR$(&H50); CHR$(&H42); CHR$(&H1); CHR$(&HA)
 CASE 65
  PRINT #nbr, CHR$(&H0); CHR$(&H50); CHR$(&H42); CHR$(&H1); CHR$(&HA)
 CASE 66
  PRINT #nbr, CHR$(&H0); CHR$(&H50); CHR$(&H42); CHR$(&H1); CHR$(&HA)
 CASE 67
  PRINT #nbr, CHR$(&H0); CHR$(&H50); CHR$(&H42); CHR$(&H1); CHR$(&HA)
 CASE 68
  myval = "00927"
  CALL setfreqft840(myval)
  CASE 133
  myval = "01584"
  CALL setfreqft840(myval)
 CASE 134
  myval = "07050"
  CALL setfreqft840(myval)
 CASE 107 'Alt f4
  endprog = 1
END SELECT
        
CALL delay
COM(port) STOP

END SUB

SUB getfreqft840
'Integer
DIM x AS INTEGER
DIM b AS LONG
'Float
DIM f AS SINGLE
'String
DIM myval AS STRING

IF endprog = 1 THEN EXIT SUB

'Vraag naar de display frequentie.

COM(port) ON

PRINT #nbr, CHR$(&H2); CHR$(0); CHR$(0); CHR$(&H2); CHR$(&H10)

DO UNTIL LOF(nbr) >= 19
LOOP

myval = INPUT$(5, nbr)



FOR x = 1 TO 5
 freq840(x) = ASC(MID$(myval, x, 1))
NEXT x


'DO UNTIL EOF(nbr)
' x = x + 1
' freq840(x) = ASC(INPUT$(1, #nbr))
' IF x >= 5 THEN EXIT DO
'LOOP

COM(port) STOP

LOCATE 5, 1
FOR x = 1 TO UBOUND(freq840)
 PRINT freq840(x);
NEXT x


b = (freq840(3) * 256 ^ 2) + (freq840(4) * 256 ^ 1) + (freq840(5) * 1)
f = b * .01
freq = f ''For joystick

myval = RTRIM$(LTRIM$(STR$(f))) + " " + khz$
CALL deleteline(ypos, 1)
LOCATE ypos, center(myval)
COLOR 15
PRINT myval


CALL delay



END SUB

FUNCTION inkeyen$
'ToDo
'Return the inkey$ value
'See if its a function key
'Or make program stop by endprog = 1

'String
DIM myval AS STRING

myval = INKEY$

CALL datumtyd

IF LEN(myval) = 2 THEN
  xFunction = ASC(RIGHT$(myval, 1))
  flagFunctieToets = 1
  inkeyen$ = ""
  EXIT FUNCTION
END IF

IF LCASE$(myval) = "z" OR LCASE$(myval) = "q" THEN
 endprog = 1
END IF

inkeyen$ = myval

END FUNCTION

SUB joystick
''ToDo ''Not ready yet
''@26-01-2008
'Change freq with the joystick in 3 step speeds up/down

 ''Integer
 STATIC steps AS INTEGER
 DIM x AS INTEGER
 DIM z AS INTEGER
 ''Float
 DIM temp AS SINGLE
 ''Single freq steps
 CONST f1! = 1
 CONST f2! = 10
 CONST f3! = 100
 CONST f4! = 500
 CONST f5! = 1000

 IF freq = 0 THEN EXIT SUB

 temp = v
 v = .3

IF steps = 0 THEN
 steps = f1
END IF

IF STRIG(4) = -1 OR STRIG(5) = -1 THEN
 BEEP
 SELECT CASE steps
  CASE f1
   steps = f2
  CASE f2
   steps = f3
  CASE f3
   steps = f4
  CASE f4
   steps = f1
 END SELECT
 LOCATE 1, 58: PRINT SPACE$(8)
 LOCATE 1, 58: PRINT steps; khz$
 EXIT SUB
END IF


IF STRIG(2) = -1 OR STRIG(3) = -1 THEN z = steps
IF STRIG(6) = -1 OR STRIG(7) = -1 THEN z = -steps
IF z <> 0 THEN
 freq = freq + z
 CALL delay
 GOTO verder
END IF


DO

x = STICK(0)

 SELECT CASE x
  ''Freq up
  CASE IS > xjoy + 10 ''range xjoy + 10 > 128
   IF x > xjoy + 50 THEN
     z = f5
    ELSEIF x > xjoy + 40 THEN
     z = f4
    ELSEIF x > xjoy + 30 THEN
     z = f3
    ELSEIF x > xjoy + 25 THEN
     z = f2
    ELSEIF x > xjoy + 15 THEN
     z = f1
    END IF
 
  ''Freq down
  CASE IS < xjoy - 10  ''Range xjoy -10 < x
   IF x < xjoy - 50 THEN
     z = -f5
    ELSEIF x < xjoy - 40 THEN
     z = -f4
    ELSEIF x < xjoy - 30 THEN
     z = -f3
    ELSEIF x < xjoy - 25 THEN
     z = -f2
    ELSEIF x < xjoy - 15 THEN
     z = -f1
   END IF
  CASE ELSE
   x = STICK(0)
   IF x > xjoy - 5 AND x < xjoy + 5 THEN EXIT DO
 END SELECT
 
  IF freq + z >= 100 AND freq + z <= 30000 THEN
   freq = freq + z
   CALL deleteline(ypos + 2, 28)
   PRINT "Joystick "; freq; khz$; " Steps"; z
  END IF
  CALL delay
 LOOP
 
verder:
  v = temp

  ''Range check
  IF freq >= 100 AND freq <= 30000 AND z <> 0 THEN
   CALL setfreqft840(length(STR$(freq), 5))
  END IF
 
  CALL deleteline(ypos + 2, 28)
 
END SUB

FUNCTION length$ (myval AS STRING, x AS INTEGER)
''ToDo
'Make string with leading zero's
'Integer
DIM y AS INTEGER
'String
DIM myval1 AS STRING

myval1 = LTRIM$(RTRIM$(myval))

FOR y = 1 TO x
 IF LEN(myval1) < x THEN
  myval1 = "0" + myval1
   ELSE
  EXIT FOR
 END IF
NEXT y

length$ = myval1

END FUNCTION

SUB loadcfg
'Integer
DIM filenbr AS INTEGER
'String
DIM myval AS STRING

cfgflag = 1

filenbr = FREEFILE
OPEN cfg FOR INPUT AS #filenbr
 LINE INPUT #filenbr, myval
CLOSE filenbr

port = VAL(myval)

cfgflag = 0

END SUB

SUB main
'ToDo

'String
DIM myval AS STRING

CALL commandline(COMMAND$) 'Look at commandline for com1 of 2
bjoy = Detectjoystick
CALL speed                 'Determen va
CALL conversieSmeter       'Load conversion array for the Smeter
CALL basicscreen           'Show basicscreen

IF port = 1 THEN
 myval = "com1"
  ELSE
 myval = "com2"
END IF

nbr = FREEFILE ''Global
OPEN myval + ":4800,N,8,2,BIN,CD,CS,DS,LF,OP10,RB4096,RS,TB256" FOR RANDOM AS #nbr

'Hints.
'Signaalmeter and getfreqft840 do also check keyboard input.
'In delay look at inkeyen.

DO
  CALL turnprompt
  CALL Signaalmeter
  CALL getfreqft840
  CALL functionkey
  IF bjoy = 1 THEN CALL joystick
LOOP UNTIL endprog = 1

CLOSE #nbr


CLS

END SUB

SUB memorylist
'ToDo Create frequence memory list
             

END SUB

SUB savecfg (datas AS STRING)
'ToDo
''Integer
DIM filenbr AS INTEGER

filenbr = FREEFILE

OPEN cfg FOR OUTPUT AS #filenbr
 PRINT #filenbr, datas
CLOSE #filenbr

END SUB

SUB setfreqft840 (freq AS STRING)
        
'PA1VLD routine voor freq output FT840
'5 digits in freq gaarne.
'Integer
DIM x AS INTEGER
DIM lp AS INTEGER
DIM ll AS INTEGER
DIM lv AS INTEGER
'Arrays
DIM lh(0 TO 3) AS INTEGER
DIM lc(0 TO 3) AS INTEGER
'String
DIM myval AS STRING

IF LEN(freq) > 5 THEN EXIT SUB


FOR x = 1 TO 3
    IF x = 1 THEN
      lp = 4
      ll = 2
     ELSE
      IF x = 2 THEN
        lp = 2
        ll = 2
         ELSE
        IF x = 3 THEN
         lp = 1
         ll = 1
        END IF
      END IF
    END IF


    lv = VAL(MID$(freq, lp, ll))
    'PRINT lv;
    lc(x) = lv

  NEXT x

  FOR x = 1 TO 3
    myval = RIGHT$(STR$(lc(x)), 2)
    IF x <> 3 THEN
      lh(x) = 16 * (VAL(LEFT$(myval, 1)))
    ELSE
      lh(x) = 0
    END IF

    lh(x) = lh(x) + VAL(RIGHT$(myval, 1))
  NEXT x

'Regel voor de Ft840

PRINT #nbr, CHR$(&H0); CHR$(lh(1)); CHR$(lh(2)); CHR$(lh(3)); CHR$(&HA)

END SUB

SUB Signaalmeter
'Float
DIM x AS SINGLE
'String
DIM myval AS STRING
DIM b AS STRING

IF endprog = 1 THEN EXIT SUB

COM(port) ON

'Vraag de S-Meter op van de ft840
PRINT #nbr, CHR$(0); CHR$(0); CHR$(0); CHR$(0); CHR$(247)

CALL delay

DO UNTIL LOF(nbr) >= 15
LOOP

x = ASC(INPUT$(1, nbr))
DO UNTIL EOF(nbr)
 binsmeter840(x) = ASC(INPUT$(1, #nbr))
 x = x + 1
LOOP

COM(port) STOP

x = 255 / 15 - 5.5

IF binsmeter840(1) < 2 * x THEN b$ = smeter(1)
IF binsmeter840(1) >= 2 * x AND binsmeter840(1) < 3 * x THEN b = smeter(2)
IF binsmeter840(1) >= 3 * x AND binsmeter840(1) < 4 * x THEN b = smeter(3)
IF binsmeter840(1) >= 4 * x AND binsmeter840(1) < 5 * x THEN b = smeter(4)
IF binsmeter840(1) >= 5 * x AND binsmeter840(1) < 6 * x THEN b = smeter(5)
IF binsmeter840(1) >= 6 * x AND binsmeter840(1) < 7 * x THEN b = smeter(6)
IF binsmeter840(1) >= 7 * x AND binsmeter840(1) < 8 * x THEN b = smeter(7)
IF binsmeter840(1) >= 8 * x AND binsmeter840(1) < 9 * x THEN b = smeter(8)
IF binsmeter840(1) >= 9 * x AND binsmeter840(1) < 10 * x THEN b = smeter(9)
IF binsmeter840(1) >= 10 * x AND binsmeter840(1) < 11 * x THEN b = smeter(9)
IF binsmeter840(1) >= 11 * x AND binsmeter840(1) < 12 * x THEN b = smeter(10)
IF binsmeter840(1) >= 12 * x AND binsmeter840(1) < 13 * x THEN b = smeter(11)
IF binsmeter840(1) >= 13 * x AND binsmeter840(1) < 14 * x THEN b = smeter(12)
IF binsmeter840(1) >= 14 * x AND binsmeter840(1) < 15 * x THEN b = smeter(13)
IF binsmeter840(1) >= 15 * x AND binsmeter840(1) < 16 * x THEN b = smeter(14)
IF binsmeter840(1) = 255 THEN b = smeter(15)

CALL deleteline(ypos, 1)
LOCATE ypos - 1, center(b)
PRINT b

END SUB

SUB speed

'ToDo Snelheids bepaling.
'Tellen hoeveel keer in een seconde variable va

'Integer
DIM start AS LONG

va = 0
start = TIMER

DO
 va = va + 1
LOOP UNTIL ABS(TIMER - start) >= 1

END SUB

SUB stripe
'Integer
DIM x AS INTEGER

FOR x = 1 TO 80
 PRINT CHR$(196);
NEXT x

END SUB

SUB turnprompt
'Integer
STATIC tel AS INTEGER

tel = tel + 1
LOCATE ypos - 2, 40
COLOR 14
 IF tel = 1 THEN
 PRINT "/"
  ELSEIF tel = 2 THEN
   PRINT "-"
   ELSEIF tel = 3 THEN
  PRINT "\"
 tel = 0
END IF

END SUB

-----------------------------------------
Have fun with this
You may improve it and change it as you wish.
See it as an example how to do things...
I have written more sofisticated cat control software in Visual Basic 6.0

Suk6 from Lodewijk PA3BNX@PI8OSS as long as PI8SHB is off line.


Read previous mail | Read next mail


 23.12.2024 01:13:12lGo back Go up