### Author Topic: display problem fixed  (Read 654 times)

0 Members and 1 Guest are viewing this topic.

#### bikemadness ##### display problem fixed
« on: November 05, 2017 »
It's been a while, but I had to show this one.

The end result of this might not be of use to most people,
but the programming might. (resistor paralleling values)
My problem was displaying more inputs than I needed,
but only using two or more of those inputs.
All in a simple program. D-pad to navigate.

Code: [Select]
`restore resistorsread setsdim Rset\$(sets)dim Rnos(sets)dim R(sets)for a=1 to setsread Rset\$(a)read Rnos(a)R(a)=1next arestore valuesread resistordim Rv(resistor)for a=1 to resistorread Rv(a)next asel=1open window 640,512repeatanswer=0setdispbuf vmvm=1-vmsetdrawbuf vmclear windowc=peek("port1")if and(c,128)<>0 left=1if left=1 L=L+1if L>2 L=2if L=2 left=0if and(c,128)=0 L=0if and(c,32)<>0 right=1if right=1 R=R+1if R>2 R=2if R=2 right=0if and(c,32)=0 R=0if left=1 sel=sel-1if right=1 sel=sel+1if sel<1 sel=1if sel>8 sel=8if and(c,16)<>0 up=1if up=1 U=U+1if U>2 U=2if U=2 up=0if and(c,16)=0 U=0if and(c,64)<>0 down=1if down=1 D=D+1if D>2 D=2if D=2 down=0if and(c,64)=0 D=0for a=1 to setsif sel=a thensetrgb 1,0,256,0elsesetrgb 1,256,256,256endiftext 50*a+50,150,Rset\$(a)next afor a=1 to selif sel=a and up=1 R(a)=R(a)+1if sel=a and down=1 R(a)=R(a)-1if R(a)<1 R(a)=1if R(a)>5 R(a)=5for b=1 to resistorif R(a)=b Rnos(a)=Rv(b)next bsetrgb 1,256,256,256text 50*a+50,165,str\$(Rnos(a))next afor a=1 to selanswer=answer+1/Rnos(a)next atext 500,165,str\$(1/answer)until (1=0)label resistorsdata 8data "R1",0data "R2",0data "R3",0data "R4",0data "R5",0data "R6",0data "R7",0data "R8",0label valuesdata 5data 2.2,3.3,8,15,39 `
Have a Yahappy day.
I don't know what is wrong with the world - but I know how to fix it.

#### rain_storm

• Here comes the Rain
•      •  