Loading ...
Sorry, an error occurred while loading the content.
 

Re: Lissajou

Expand Messages
  • Rod
    Less buggy version of an oscilliscope lissajous syatem. nomainwin dim hz1$(12) dim hz2$(12) dim vo1$(24) dim vo2$(24) dim ph1$(360) dim ph2$(360) WindowWidth =
    Message 1 of 40 , Dec 3, 2010
      Less buggy version of an oscilliscope lissajous syatem.

      nomainwin
      dim hz1$(12)
      dim hz2$(12)
      dim vo1$(24)
      dim vo2$(24)
      dim ph1$(360)
      dim ph2$(360)

      WindowWidth = 600
      WindowHeight = 700
      graphicbox #1.gb 45,20,500,500
      statictext #1.hz, "Hertz" ,125, 560,80,20
      combobox #1.hz1, hz1$(),[hertz1],125,580,80,20
      combobox #1.hz2, hz2$(),[hertz2],125,620,80,20
      statictext #1.ph, "Phase" ,225, 560,80,20
      combobox #1.ph1, ph1$(),[phs1],225,580,80,20
      combobox #1.ph2, ph2$(),[phs2],225,620,80,20
      statictext #1.vo, "Volume" ,325, 560,80,20
      combobox #1.vo1, vo1$(),[vol1],325,580,80,20
      combobox #1.vo2, vo2$(),[vol2],325,620,80,20
      open "Lissajous" for window as #1
      #1, "trapclose [quit]"


      for n= 1 to 10
      hz1$(n)=str$(n)
      hz2$(n)=str$(n)
      next

      for n= 1 to 12
      vo1$(n)=str$(n*20)
      vo2$(n)=str$(n*20)
      next

      for n= 0 to 359 step 45
      ph1$(n)=str$(n)
      ph2$(n)=str$(n)
      next


      'set the initial combobox data
      #1.hz1 "reload"
      #1.hz1 "select 1"
      hertz1=1
      #1.hz2 "reload"
      #1.hz2 "select 1"
      hertz2=1
      #1.vo1 "reload"
      #1.vo1 "select 100"
      vol1=100
      #1.vo2 "reload"
      #1.vo2 "select 100"
      vol2=100
      #1.ph1 "reload"
      #1.ph1 "select 0"
      phase1=0
      #1.ph2 "reload"
      #1.ph2 "select 0"
      phase2=0

      #1.gb "down ; fill 0 50 0"
      #1.gb "color 50 50 50"
      for x= 20 to 580 step 20
      #1.gb "line ";x;" 0 ";x;" 600"
      next
      for y= 20 to 580 step 20
      #1.gb "line 0 ";y;" 600 ";y
      next
      #1.gb "flush one"
      #1.gb "color 0 100 0"

      midX=250
      midY=250
      rad=57.29577951



      [drawit]
      start=0
      #1.gb "discard ; redraw one"
      for n= 0 to 359
      x=midX-(vol1*sin(phase1/rad))
      y=midY-(vol2*cos(phase2/rad))
      if start=1 then
      #1.gb "line ";oldX;" ";oldY;" ";x;" ";y
      else
      start=1
      #1.gb "set ";x;" ";y
      end if
      oldX=x
      oldY=y
      phase1=phase1+hertz1
      if phase1>359 then phase1=phase1-360
      phase2=phase2+hertz2
      if phase2>359 then phase2=phase2-360

      next
      wait


      [hertz1]
      #1.hz1 "contents? text$"
      hertz1=val(text$)
      goto [drawit]

      [hertz2]
      #1.hz2 "contents? text$"
      hertz2=val(text$)
      goto [drawit]

      [vol1]
      #1.vo1 "contents? text$"
      vol1=val(text$)
      goto [drawit]

      [vol2]
      #1.vo2 "contents? text$"
      vol2=val(text$)
      goto [drawit]

      [phs1]
      #1.ph1 "contents? text$"
      phase1=val(text$)
      goto [drawit]

      [phs2]
      #1.ph2 "contents? text$"
      phase2=val(text$)
      goto [drawit]


      [quit]
      timer 0
      close #1
      end
    • Gordon S
      I just woke up and found my old program for showing the colour codes Gordon S. RESISTOR Colour Codes nomainwin : dim c$(10) WindowWidth = 500 : WindowHeight
      Message 40 of 40 , Nov 2, 2011
        I just woke up and found my old program for showing the colour codes

        Gordon S.

        ' RESISTOR Colour Codes
        nomainwin : dim c$(10)
        WindowWidth = 500 : WindowHeight = 400
        open "Colour Codes" for graphics_nsb as #r
        #r "trapclose [quit]; down; font fixedsys"
        [start]
        #r "cls; place 200 20; backcolor white; color black" : #r "\RESISTORS"
        #r "place 100 170" : #r "\RESISTOR / CAPACITOR Colour Codes"
        #r "place 150 280; color red" : #r "\Select the 3 colours"
        #r "color black"
        for d = 0 to 9
        #r "place ";d*30+106;" 190" : #r "\";d
        next d
        #r "backcolor lightgray"
        #r "place 170 30; boxfilled 320 60"
        #r "place 170 80; box 320 110"
        #r "size 3; line 100 45 170 45; line 320 45 390 45"
        #r "line 100 95 170 95; line 320 95 390 95; size 1"

        xp = 100 : restore
        for c = 1 to 10
        read d$ : c$(c) = d$
        #r "backcolor ";c$(c)
        #r "place ";xp;" 200; boxfilled ";xp+20;" 240"
        xp = xp + 30
        next c
        #r "backcolor white;when leftButtonDown [pick]" : r = 1
        xr = 190 : n = 1 : v$ = "" : wait
        [show]
        #r "backcolor ";c$(k+1)
        if n < 3 then v$ = v$ + str$(k)
        if n = 1 then #r "place 170 80; boxfilled 320 110"
        if n = 2 then #r "place 170 80; boxfilled 190 110"
        if n = 3 then #r "place 250 96; circlefilled 14"
        #r "place ";xr;" 30; boxfilled ";xr+10;" 60"
        xr = xr + 20 : n = n + 1 : if n < 4 then wait
        #r "backcolor darkgray; place 250 30; boxfilled 260 60"
        #r "place 300 80; boxfilled 320 110"
        #r "color yellow; place 60 280"
        #r "\ Tolerance: Gold 5% Silver 10% Unmarked 20% "
        #r "color darkblue; backcolor white; place 160 300"
        for z = 1 to k : v$ = v$ +"0" : next
        #r "\SELECTED VALUE = ";v$ : #r "place 100 320; color black"
        #r "\Preferred values and multiples are :-"
        #r "\ 10 12 15 18 22 27 33 39 47 56 68 82"
        #r "flush" : confirm "Another?"; q$
        if q$ = "yes" then [start]
        #r "when leftButtonDown" : wait

        [pick]
        if MouseY > 240 or MouseY < 200 then wait
        x1 = 100 : x2 = 120 : c = 99 : k = 99
        for t = 1 to 10
        if MouseX > x1 and MouseX < x2 then k = t-1
        x1 = x1 + 30 : x2 = x2 + 30
        next
        if k > 9 then wait
        r = r + 1 : goto [show]

        [quit] close #r : end

        data "black","130 50 10","red","220 120 20","yellow"
        data "green","blue","150 30 200","darkgray","white"
        end
      Your message has been successfully submitted and would be delivered to recipients shortly.