aUCBLogo Demos and Tests / steppermotorlayout
to steppermotorlayout
elements=
[ [yellow5
j 14 minus 13
j 18 minus 18
j 23 minus 23
j 28 minus 28
e 17 f 15
e 21 f 24
c 18 c 22
]
[orange4
2j 15 2plus 15
e 19 f 19
]
[blue6
e 23 f 29
2minus 5 pin 20
]
[violet7
2j 17 a 17
2j 19 a 19
2j 21 a 21
2j 23 a 23
]
[brown10
a 22 a 32
]
[red20
f 13 pin 2
f 17 pin 3
minus 3 black -10
plus 40 2plus 40
minus 39 2minus 39
]
[orange30
f 22 pin 4
f 27 pin 5
2plus 10 red -10
]
[Resistor_1KOhm
2plus 13 g 13
2plus 16.8 g 17
2plus 27 g 22
2plus 28 g 27
2plus 33 e 32
]
[redLED ;long wire is first point, short second
d 18 d 17
]
[greenLED
b 18 b 19
]
[yellowLED
d 22 d 23
b 22 b 21
]
[Diode_1N4001 ;ring (minus) is second point
2i 17 2plus 16
2i 19 2plus 18
2i 21 2plus 21
2i 23 2plus 24
]
[PNP_Transistor_2N6489 ;first is basis
i 13 i 15
i 17 i 19
i 22 i 24
i 27 i 29
]
[Clamp
2f 15 2f 15 ;stepper motor brown
2f 17 2f 17 ;stepper motor red
2f 19 2f 19 ;stepper motor blue
2f 21 2f 21 ;stepper motor white
2f 23 2f 23 ;stepper motor yellow
]
]
pr [Small diskette stepper motor: brown(=Plus) red blue white yellow]
cs ht WindowMode
size=14
y0=280
red=rgb 1 0 0
blue=rgb 0 0 1
grey=rgb .5 .5 .5
drawClampboard
xt=Table 20
xt'a=1 xt'b=2 xt'c=3 xt'd=4 xt'e=5
xt'f=8 xt'g=9 xt'h=10 xt'i=11 xt'j=12
xt'plus=15 xt'minus=16
xt'2a= -17 xt'2b= -16 xt'2c= -15 xt'2d= -14 xt'2e= -13
xt'2f= -10 xt'2g= -9 xt'2h= -8 xt'2i= -7 xt'2j= -6
xt'2plus= -3 xt'2minus= -2
xt'pin=0
xt'red= -10 xt'black=10
foreach elements
[ proc=first ?
coors=bf ?
while [not empty? coors]
[ x=xt.(coors.1)
y=coors.2
x2=xt.(coors.3)
y2=coors.4
run proc
coors=bf bf bf bf coors
]
]
end
to drawwire
setPS (list size*0.2 size*0.2)
setXY size*x y0-size*y
pd
setFC pc
fillCircle size*0.25
setXY size*x2 y0-size*y2
fillCircle size*0.25
pu
end
to drawblock
setPS (list size*0.7 size*0.7)
setXY size*x y0-size*y
pd setXY size*x2 y0-size*y2 pu
end
to yellow5
setPC "yellow
drawwire
end
to orange4
setPC "orange
drawwire
end
to blue6
setPC "blue
drawwire
end
to violet7
setPC "violet
drawwire
end
to brown10
setPC "brown
drawwire
end
to red20
setPC "red
drawwire
end
to orange30
setPC "orange
drawwire
end
to Resistor_1KOhm
setPC "grey
drawwire
sx=x sx2=x2 sy=y sy2=y2
x=(2*sx+sx2)/3
y=(2*sy+sy2)/3
x2=(sx+2*sx2)/3
y2=(sy+2*sy2)/3
setPC rgba .8 .5 .3 .5
drawblock
end
to redLED
setPC rgba 1 0 0 .5
drawwire
drawblock
end
to greenLED
setPC rgba 0 1 0 .5
drawwire
drawblock
end
to yellowLED
setPC rgba 1 1 0 .5
drawwire
drawblock
end
to Diode_1N4001
setPC rgba 0 0 0 .5
drawwire
sx=x sx2=x2 sy=y sy2=y2
x=(2*sx+sx2)/3
y=(2*sy+sy2)/3
x2=(sx+2*sx2)/3
y2=(sy+2*sy2)/3
setPC rgba 0 0 0 .5
drawblock
end
to PNP_Transistor_2N6489
setPC rgba 0 0 0 .5
drawblock
end
to Clamp
setPC rgba 0 1 0 .5
drawblock
end
to pix c
pu
setXY x*size y0-y*size
setPC c
pd
Circle 0.25*size
pu
end
to connect
pu
setXY (x+0.25)*size y0-y*size
pd
setXY (x+0.75)*size y0-y*size
pu
end
to lab ch
pu setXY x*size y0-y*size Label ch
end
to ybse
for [y 5 40 5][lab y]
end
to drawClampboard
for [y 1 40]
[ for [x 1 4] [pix grey connect] x=5 pix grey
for [x 8 11] [pix grey connect] x=12 pix grey
for [x -7 -10] [pix grey connect] x=-6 pix grey
for [x -14 -17] [pix grey connect] x=-13 pix grey
]
for [n 0 6]
[ for [y 3+n*6 3+n*6+4]
[ x=15 pix red
x=16 pix blue
x=-3 pix red
x=-2 pix blue
]
]
setPC "black
home
right 90
y=0
for [x -13 -17][lab char 96+18+x]
for [x -6 -10][lab char 96+16+x]
for [x 1 5][lab char 96+x]
for [x 8 12][lab char 94+x]
x=-18.5 ybse
x=-11.5 ybse
x=-4.5 ybse
x=-0.5 ybse
x=6.5 ybse
x=13.5 ybse
end