Two BASIC Programs

Two BASIC Lighting Programs

Both of these short lighting programs were written during the summer of 1993. Because the machine the University placed in my office used MS-DOS 3.3 as the operating system, these small utilities were written not in QBasic but in the older GWBASIC. They were later rewritten in C, compiled, and included in the LiteCalc package.

The programs will run in either GWBASIC or in QBASIC. To download the source code save this page as a Plain Text (*.txt) file, and use the copy and paste functions of a text editor (such as Windows' NotePad) to create the necessary *.bas files.

To run the programs, type gwbasic filename.bas or qbasic /run filename.bas at the DOS prompt.

Source code for
BEAMDIA.BAS and ALITE.BAS


Source code for BEAMDIA.BAS

010 PRINT "BEAMDIA.BAS"
020 PRINT "   by Larry Wild, Northern State University"
030 PRINT "   Ver 1.0 written August 1993"
040 PRINT
050 PRINT "This program will determine pool diameter given"
060 PRINT "   beam angle and throw distance"
070 PRINT
080 INPUT "Beam angle in degrees:>         ", BMANG
090 INPUT "Throw distance in feet:>        ", THROW
100 RADHLFBMANG = .017453 * (BMANG/2)
110 DIA =  2 * (THROW * TAN (RADHLFBMANG))
120 PRINT
130 PRINT "Diameter of the pool of light: " DIA; " feet"
140 PRINT
150 INPUT "Repeat ? (Y/N:> ", ANS$
160 PRINT : PRINT
170 IF ANS$ = "Y" OR ANS$ = "y" THEN GOTO 80
180 SYSTEM
Return to the top

Source Code for ALITE.BAS

10 PRINT "ALITE.BAS"
20 PRINT "   by Larry Wild"
30 PRINT "   Ver 1.0 written August 1993"
40 PRINT
50 PRINT "This program will determine the size of a pool of light given"
80 PRINT "   the beam angle and elevational and plan distance"
90 PRINT "   between the lamp and the focus point."
100 PRINT
110 RADTODEG = 57.295827#                           'radians to degrees
120 DEGTORAD = .0174532                             'degrees to radians
130 INPUT "Elevation in feet>           ", ELV      'elevation
140 ELV = ELV - 6
150 INPUT "Plan Distance in feet>       ", BSE      'plan distance
160 INPUT "Beam angle in degrees>       ", BMANG    'beam angle
170 THROW = SQR(ELV ^ 2 + BSE ^ 2)                  'diagonal throw
180 PRINT
190 PRINT "Throw distance:             "; THROW; " feet"
200 RADELVANG = ATN(BSE / ELV)                      'elevation angle
210 ELVANG = RADELVANG * RADTODEG                   '   to vertical
220 PRINT "Elevation angle:            "; 90 - ELVANG; " degrees"
230 HLFBMANG = BMANG / 2                            'half beam angle
240 RADHLFBMANG = HLFBMANG * DEGTORAD               ' in radians
250 LNBSE = ELV * TAN(RADELVANG + RADHLFBMANG)      'long base
260 SHTBSE = ELV * TAN(RADELVANG - RADHLFBMANG)     'short base
270 LNGAXIS = LNBSE - SHTBSE                        'long axis of pool
280 PRINT
290 PRINT "The long axis:              "; LNGAXIS; " feet"
300 PRINT "   Distance DS of focus pt: "; BSE - SHTBSE; " feet"
310 PRINT "   Distance US of focus pt: "; LNBSE - BSE; " feet"
320 PRINT
330 SHTAXIS = 2 * (THROW * TAN(RADHLFBMANG))        'short axis of pool
340 PRINT "Short axis:                 "; SHTAXIS; " feet"
350 PRINT
360 INPUT "Repeat ? (Y or N)>  ", ANS$
370 IF ANS$ = "Y" OR ANS$ = "y" THEN GOTO 100
380 SYSTEM
Return to the top
Last updated: January 8, 1997
Return to Larry's Home Page