Plots a 5 volt square wave.
Appears on
One of a series of library tapes. Programs on these tapes were renamed to a number series. This tape contained programs 20001 to 20050. These tapes were compiled by Tony Willing.
Gallery
Source Code
10 REM Square wave graph 11 REM plotting program 12 REM 100 REM Set up 101 REM 110 PAPER 0: INK 6: BORDER 0: CLS 120 PRINT "VOLTS = ": FOR x=1 TO 6: PRINT AT x*3,0;6-x: NEXT x 130 INK 3: PLOT 7,151: DRAW 0,-120: DRAW 247,0: INK 6 140 PRINT AT 1,17;"Square Wave" 150 DIM a$(9) 200 REM 201 REM Plotting Loop 202 REM 210 FOR x=0 TO 400 211 REM 220 REM Calculate volts 221 REM 230 LET volts=2.5+10*SIN (x/40) 240 IF volts>5 THEN LET volts=5 250 IF volts<0 THEN LET volts=0 300 REM 301 REM Plot values 302 REM 310 PLOT INK 7;8+(24*x/40),32+volts*24 320 REM 321 REM Print values 322 REM 330 PRINT AT 0,7;volts;a$ 340 PRINT AT 21,15;x/40;a$ 350 REM 351 REM End loop 352 REM 360 NEXT x 370 STOP