FOR Command

I’m writing below simple program, but the status of my program is getting off and also is not working . any help on this guys ?
10 REM MAKE A SLOW RAMP ON OUT 20 FROM 0 to 10000
20 IF VAR17 = 1 THEN GOSUB 40 ELSE OUT20 = 0
30 END
40 FOR VAR14 = 0 TO 10000 STEP 0.1
50 OUT20=VAR14 / 111
60 WAIT 0.100
70 NEXT VAR14

I am always leery of jumping around in programs, working linearly makes maintenance much easier later on because the program is simple to follow, the logic just flows through from one line to the next. Internally, T3000 will start the program again at the top after each scan so there’s no need for end or gosub statements. Of course you can experiment around with the various increments and make them smaller or larger. Limit the wait statement to whole number, one second or larger increments.

10 REM MAKE A SLOW RAMP ON OUT 20 FROM 0 to 10000
20 VAR14 = VAR14 + 0.1

30 IF VAR14 > 10 THEN VAR14 = 0

40 OUT20=VAR14
50 WAIT 0:0:01

image001.jpg

1 Like

That’s true to do not use jumping is better .
but i want to reach 1 but your program like 2(attached picture)Untitled

Sure, you can get this with one small change:

20 VAR14 = VAR14 + 0.1

30 IF VAR14 > 10 THEN VAR14 =10

40 OUT20=VAR14
50 WAIT 0:0:01

2 Likes