'   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '           N a m e :   W X M _ R o t a t i n g G r i p p e r _ 0 2 . t x t                               D a t e :   3 1   M a y   2 0 2 1 
 
 '         A u t o r :   L e o n a r d o   D E   P A L O 
 
 '         S c o p e :   M o v e   t h e   t w o   g r i p p e r   w i t h   P r o t o c o l 1   o f   F e e T e c h . 
 
 '   H a r d w a r e :   S t a n d a r d   M a s t e r . 
 
 '   n o t e : 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 O p t i o n   S p e e d   9 
 
 O p t i o n   G l o b a l K e y s   E n a b l e d 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   I n i t i a l i z e   S L O T S ,   B U T T O N S   a n d   K E Y S 
 
 G o s u b   S e t S l o t s 
 
 S l o t ( S l o t _ E m e r g e n c y )   =   0 
 
 S l o t ( S l o t _ P a u s e )   =   0 
 
 G o s u b   S e t B u t t o n s A n d K e y s 
 
 ' G o s u b   D i s a b l e A l l B u t t o n s 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   T o r q u e   p a r a m e t e r s   -   D o o r L o c k 
 
 '   D o o r L o c k   l i m i t :   1 . 5   n e w t o n / m e t e r 
 
 '   D o o r L o c k   l i m i t :   1 5 . 3   k g / c m 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   T o r q u e   p a r a m e t e r s   -   M o t o r 
 
 '   M o t o r   t e s t :   6 7 9   c u r r e n t   =   3 5 2   g / 2 5 c m 
 
 '   M o t o r   t e s t :   6 7 9   c u r r e n t   =   8 . 8   k g / c m 
 
 '   M o t o r   t e s t :   6 7 9   c u r r e n t   =   0 . 8 6 3   n / m 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 C o e f f _ N M   =   0 . 0 0 1 2 7 1     ' ( 0 . 8 6 3   /   6 7 9 ) 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   R o t a t i o n   s o f t w a r e   l i m i t s 
 
 R m a x                       =   + 3 0 7 1 9 
 
 R m i n                       =   - 3 0 7 1 9 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   P e n   U p   /   D o w n   s e t   u p 
 
 P e n U p _ V a l u e         =   4 9 0 
 
 P e n D o w n _ V a l u e     =   6 6 0 
 
 
 
 T o r q u e L i m i t M 1   =   9 e 9 9 
 
 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   L O A D   A P P S 
 
 L o a d   " T h e r e m i n o _ R S 4 8 5 \ T h e r e m i n o _ R S 4 8 5 . e x e " 
 
 L o a d   " T h e r e m i n o _ H A L \ T h e r e m i n o _ H A L . e x e " 
 
 L o a d   " T h e r e m i n o _ H A L \ T h e r e m i n o _ S l o t V i e w e r . e x e " 
 
 L o a d   " T h e r e m i n o _ H A L \ T h e r e m i n o _ S l o t V i e w e r 1 . e x e " 
 
 L o a d   " T h e r e m i n o _ H A L \ T h e r e m i n o _ S l o t V i e w e r 5 . e x e " 
 
 L o a d   " T h e r e m i n o _ H A L \ T h e r e m i n o _ S i g n a l S c o p e _ M O T O R _ T O R Q U E . e x e " 
 
 
 
 ' '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   T E S T   M A S T E R   P R E S E N T 
 
 ' F o r   v 1   =   1   T o   9 e 9 9 
 
 ' 	 F o r   v 2   =   1   T o   2 0   '   < < <   t e s t i n g   f o r   2   s e c o n d s 
 
 ' 	 	 I f   ( S l o t ( 0 )   > =   1   A n d   S l o t ( 0 )   < =   2 )   O r   K e y ( " C T R L " ) 
 
 ' 	 	 	 E x i t   2 
 
 ' 	 	 E n d I f 
 
 ' 	 	 W a i t   S e c o n d s   0 . 1 
 
 ' 	 N e x t 
 
 ' 	 P r i n t   "   I n v a l i d   m a s t e r   n u m b e r :   "   +   S l o t ( 0 )   +   C R L F 
 
 ' 	 S l o t   0   =   R e c o g n i z e 
 
 ' 	 B e e p 
 
 ' N e x t 
 
 ' 
 
 ' '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   T E S T   M O T O R S   W O R K I N G 
 
 ' S l o t   ( S l o t _ T e m p e r a t u r e )   =   - 9 9 9 
 
 ' F o r   v 1   =   1   T o   9 e 9 9 
 
 ' 	 F o r   v 2   =   1   T o   2 0   '   < < <   t e s t i n g   f o r   2   s e c o n d s 
 
 ' 	 	 I f   S l o t   ( S l o t _ T e m p e r a t u r e )   >   - 9 9 9   O r   K e y ( " C T R L " ) 
 
 ' 	 	 	 P r i n t   " " 
 
 ' 	 	 	 E x i t   2 
 
 ' 	 	 E n d I f 
 
 ' 	 	 W a i t   S e c o n d s   0 . 1 
 
 ' 	 N e x t 
 
 ' 	 P r i n t   "   M o d b u s   n o t   w o r k i n g "   +   C R L F 
 
 ' 	 B e e p 
 
 ' N e x t 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   R e s t o r e   o l d   m o t o r   p o s i t i o n s   a n d   v a r i a b l e s 
 
 G o s u b   R e s t o r e V a r s A n d P o s i t i o n s 
 
 G o s u b   S h o w S e q u e n c e N a m e 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   M i s c e l l a n o u s   s t a r t 
 
 ' G o s u b   P e n U p 
 
 ' W i n d o w   M i n S i z e 
 
 ' W a i t   S e c o n d s   1 
 
 
 
 ' L o a d   " m e d i a \ i m a g e s \ S M 2 9 _ R o t a t i n g G r i p p e r . p n g " 
 
 ' G o s u b   B l u e O n 
 
 
 
 ' W a i t   S e c o n d s   1 
 
 ' B u t t o n     s o u n d \ g o n g . w a v 
 
 L o a d   H i d e 
 
 G o s u b   I n i t M o t o r s 
 
 
 
 O p t i o n   G l o b a l K e y s   D i s a b l e d 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     M A I N   L O O P 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   M a i n L o o p 
 
 	 G o s u b   C h e c k M o t o r T e m p e r a t u r e 
 
 	 G o s u b   U p d a t e B u t t o n s 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 	 '   0 . 0 2   s e c .   o r   m o r e   t o   a l l o w   t i m e   f o r   k e y s   a n d   o t h e r   t a s k s 
 
 	 W a i t   S e c o n d s   0 . 1 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 G o t o   M a i n L o o p 
 
 
 
 L a b e l   U p d a t e B u t t o n s 
 
 	 B u t t o n   m 1   T e x t   " M 1 = "   +   F o r m a t ( S l o t ( S l o t _ D e s t i n a t i o n 1 )   *   3 6 0   /   4 0 9 6 ,   " 0 . 0 " ) 
 
 R e t u r n 
 
 
 
 S t o p 	 	 	 	 	 	   	 	 	 	 	 	 	 	 	 	 ' 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     B U T T O N S   A N D   K E Y S 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   S e t B u t t o n s A n d K e y s 
 
 	 B u t t o n   1   T e x t   I n i t P o s i t i o n s 
 
 	 B u t t o n   I n i t P o s i t i o n s   C o l o r   S k y B l u e 
 
 	 
 
 	 B u t t o n   2   T e x t   E n a b l e M o t o r s 
 
 	 B u t t o n     E n a b l e M o t o r s   T e x t   " E n a b l e   M o t o r s " 
 
 	 
 
 	 B u t t o n   3   T e x t     D i s a b l e M o t o r s 
 
 	 B u t t o n   D i s a b l e M o t o r s   T e x t   " D i s a b l e   M o t o r s " 
 
 	 
 
 	 B u t t o n   5   T e x t   E d i t S e q u e n c e 
 
 	 B u t t o n   E d i t S e q u e n c e   T e x t   " O p e n   U n L o c k - L o c k . s e q " 
 
 	 B u t t o n   E d i t S e q u e n c e   C o l o r   P a l e G r e e n 
 
 	 
 
 	 B u t t o n   6   T e x t   R u n S e q u e n c e 
 
 	 B u t t o n   R u n S e q u e n c e   T e x t   " T E S T " 
 
 	 B u t t o n   R u n S e q u e n c e   C o l o r   A q u a 
 
 	 
 
 	 B u t t o n   7   T e x t   S e l e c t S e q u e n c e 
 
 	 B u t t o n   S e l e c t S e q u e n c e   T e x t   " S e l e c t   S e q u e n c e " 
 
 	 B u t t o n   S e l e c t S e q u e n c e   C o l o r   P o w d e r B l u e 
 
 	 
 
 	 B u t t o n   9   T e x t   " M 1 " 
 
 	 B u t t o n   M 1   C o l o r   Y e l l o w 
 
 	 B u t t o n   M 1   T e x t   " M 1 " 
 
 	 
 
 	 B u t t o n   1 3   T e x t   R e s e t L o g C o u n t e r 
 
 	 B u t t o n   R e s e t L o g C o u n t e r   T e x t   " R e s e t   L o g   c o u n t e r " 
 
 	 B u t t o n   R e s e t L o g C o u n t e r   C o l o r   W h i t e 
 
 	 
 
 	 B u t t o n   1 4   T e x t   " M o t o r T e m p " 
 
 	 B u t t o n   M o t o r T e m p   C o l o r   S a l m o n 
 
 	 
 
 	 B u t t o n   1 5   T e x t   C l o s e A l l 
 
 	 B u t t o n   C l o s e A l l   T e x t   " C L O S E   A L L " 
 
 	 B u t t o n   C l o s e A l l   C o l o r   R e d 
 
 	 
 
 	 B u t t o n   1 6   T e x t     E m e r g e n c y 
 
 	 B u t t o n   E m e r g e n c y   T e x t   " E M E R G E N C Y " 
 
 	 B u t t o n   E m e r g e n c y   C o l o r   R e d 
 
 	 B u t t o n   E m e r g e n c y   S l o t     S l o t _ E m e r g e n c y 
 
 	 
 
 	 B u t t o n   1 7   T e x t   R e d O n 
 
 	 B u t t o n   R e d O n   C o l o r   R e d 
 
 	 
 
 	 B u t t o n   1 8   T e x t   M a g e n t a O n 
 
 	 B u t t o n   M a g e n t a O n   C o l o r   M a g e n t a 
 
 	 
 
 	 B u t t o n   1 9   T e x t   Y e l l o w O n 
 
 	 B u t t o n   Y e l l o w O n   C o l o r   Y e l l o w 
 
 	 
 
 	 B u t t o n   2 0   T e x t   G r e e n O n 
 
 	 B u t t o n   G r e e n O n   C o l o r   G r e e n 
 
 	 
 
 	 B u t t o n   2 1   T e x t   B l u e O n 
 
 	 B u t t o n   B l u e O n   C o l o r   M e d i u m B l u e 
 
 	 
 
 	 B u t t o n   2 2   T e x t   W h i t e O n 
 
 	 B u t t o n   G r e e n O n   C o l o r   G r e e n 
 
 	 
 
 	 B u t t o n   2 5   T e x t   R g b O f f 
 
 	 B u t t o n   R g b O f f   C o l o r   B l a c k 
 
 	 
 
 	 B u t t o n   2 6   T e x t   S e t C e n t e r P o s i t i o n s 
 
 	 B u t t o n   S e t C e n t e r P o s i t i o n s   T e x t   "   W A R N I N G "   +   C R L F   +   " S e t   C e n t e r   P o s i t i o n s " 
 
 	 B u t t o n   S e t C e n t e r P o s i t i o n s   C o l o r   D a r k O r a n g e 
 
 	 
 
 	 B u t t o n   2 7   T e x t   G o t o C e n t e r P o s i t i o n s 
 
 	 B u t t o n   G o t o C e n t e r P o s i t i o n s   T e x t   " G o t o   C e n t e r   P o s i t i o n s " 
 
 	 
 
 	 B u t t o n   2 9   T e x t     O p e n L o g f i l e 
 
 	 B u t t o n   O p e n L o g f i l e   T e x t   " O p e n   L o g   f i l e " 
 
 	 B u t t o n   O p e n L o g f i l e   C o l o r   P a l e G r e e n 
 
 	 
 
 	 B u t t o n   3 0   T e x t   P e n U p 
 
 	 B u t t o n   P e n U p   T e x t   " P E N   U P " 
 
 	 B u t t o n   P e n U p   C o l o r   L i g h t S t e e l B l u e 
 
 	 
 
 	 B u t t o n   3 1   T e x t   P e n D o w n 
 
 	 B u t t o n   P e n D o w n   T e x t   " P E N   D O W N " 
 
 	 B u t t o n   P e n D o w n   C o l o r   L i g h t S t e e l B l u e 
 
 	 
 
 	 B u t t o n   3 2   T e x t   P e n S i n g l e 
 
 	 B u t t o n   P e n S i n g l e   T e x t   " P E N   S I N G L E " 
 
 	 B u t t o n   P e n S i n g l e   C o l o r   L i g h t S t e e l B l u e 
 
 R e t u r n 
 
 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     M O T O R S 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V a r i a b l e   N u m e r i c   S l o t _ D e s t i n a t i o n 1 
 
 V a r i a b l e   N u m e r i c   S l o t _ P o s i t i o n 1 
 
 
 
 L a b e l   I n i t M o t o r s 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   I n i t   D e s t i n a t i o n   S l o t s 
 
 	 S l o t _ D e s t i n a t i o n 1   =   1 0 1 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   I n i t   P o s i t i o n   S l o t s 
 
 	 S l o t _ P o s i t i o n 1   =   1 0 2 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   T o r q u e   0 - 1 0 0 0   t o   m o t o r s   1 - 4 
 
 	 S l o t ( 1 2 0 )   =   8 0 0 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   A c c e l e r a t i o n   0 - 2 5 5   t o   m o t o r s   1 - 4 
 
 	 S l o t ( 1 2 1 )   =   5 0 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   S p e e d   0 - 1 0 0 0 0   t o   m o t o r s   1 - 4 
 
 	 S l o t ( 1 2 2 )   =   3 0 0 0 
 
 R e t u r n 
 
 
 
 L a b e l   E n a b l e M o t o r s 
 
 	 S l o t ( 1 2 3 )   =   1 
 
 R e t u r n 
 
 
 
 L a b e l   D i s a b l e M o t o r s 
 
 	 S l o t ( 1 2 3 )   =   0 
 
 R e t u r n 
 
 
 
 L a b e l   S e t C e n t e r P o s i t i o n s 
 
 	 ' S l o t ( 1 2 3 )   =   1 2 8 
 
 	 W a i t   S e c o n d s   0 . 5 
 
 	 G o s u b   E n a b l e M o t o r s 
 
 	 G o s u b   C o p y P o s i t i o n s T o D e s t i n a t i o n s 
 
 R e t u r n 
 
 
 
 L a b e l   C o p y P o s i t i o n s T o D e s t i n a t i o n s 
 
 	 S l o t ( S l o t _ D e s t i n a t i o n 1 )   =   S l o t ( S l o t _ P o s i t i o n 1 ) 
 
 R e t u r n 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   g o t o   t h e   m i d d l e   p o i n t   a t   2 0 4 8 
 
 L a b e l   G o t o C e n t e r P o s i t i o n s 
 
 	 S l o t ( S l o t _ D e s t i n a t i o n 1 )   =   2 0 4 8 
 
 R e t u r n 
 
 
 
 V a r i a b l e   N u m e r i c   M o t o r s T e m p e r a t u r e 
 
 L a b e l   T e s t M o t o r s T e m p e r a t u r e 
 
 	 M o t o r s T e m p e r a t u r e   =   S l o t ( 1 0 6 ) 
 
 R e t u r n 
 
 
 
 L a b e l   T o r q u e R e a d e r 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   r e a d   t h e   t o r q u e 
 
 	 V a r i a b l e   N u m e r i c   T o r q u e N M _ M o t 1 
 
 	 T o r q u e N M _ M o t 1   =   C o e f f _ N M   *   S l o t ( 1 0 4 ) 
 
 	 I f   T o r q u e N M _ M o t 1   > =   1 0 2 4 
 
 	 	 T o r q u e N M _ M o t 1   =   T o r q u e N M _ M o t 1   -   1 0 2 4 
 
 	 E n d I f 
 
 R e t u r n 
 
 
 
 L a b e l   T o r q u e T e s t e r 
 
 	 G o s u b   T o r q u e R e a d e r 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   r e a d   t h e   t o r q u e 
 
 	 V a r i a b l e   N u m e r i c   M a x T o r q u e M 1 
 
 	 T o r q u e N M _ M o t 1   =   C o e f f _ N M   *   S l o t ( 1 0 4 ) 
 
 	 M a x T o r q u e M 1   =   M a x ( M a x T o r q u e M 1 ,   T o r q u e N M _ M o t 1 ) 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   t e s t   l i m i t s 
 
 	 I f   M a x T o r q u e M 1   >   T o r q u e L i m i t M 1 
 
 	 	 G o s u b   A L A R M 
 
 	 	 R e s u l t   =   R e s u l t   +   C R L F   +   "   T o r q u e   l i m i t   M 1         " 
 
 	 	 G o s u b   U p d a t e R e s u l t T o r q u e 
 
 	 	 R e s u l t   =   R e s u l t   +   C R L F 
 
 	 	 G o s u b   U p d a t e R e s u l t 
 
 	 	 R e s u l t   =   R e s u l t   +   C R L F 
 
 	 E n d I f 
 
 R e t u r n 
 
 
 
 V a r i a b l e   N u m e r i c   M o t o r s M o v i n g 
 
 L a b e l   T e s t M o t o r s M o v i n g 
 
 	 M o t o r s M o v i n g   =   A b s ( S l o t ( 1 0 3 ) ) 
 
 R e t u r n 
 
 
 
 L a b e l   W a i t A l l M o t o r s 
 
 	 V a r i a b l e   N u m e r i c   W M 1 
 
 	 W a i t   S e c o n d s   0 . 1   '   < < <   e n s u r e s   t h a t   m o t o r s   a r e   r e a l l y   s t a r t e d 
 
 	 F o r   W M 1   =   1   T o   9 e 9 9 
 
 	 	 G o s u b   T e s t M o t o r s M o v i n g 
 
 	 	 I f   M o t o r s M o v i n g   <   0 . 0 1 
 
 	 	 	 E x i t 
 
 	 	 E n d I f 
 
 	 	 W a i t   S e c o n d s   0 . 0 0 5 
 
 	 	 G o s u b   T o r q u e T e s t e r 
 
 	 N e x t 
 
 	 W a i t   S e c o n d s   0 . 1 
 
 	 G o s u b   T o r q u e T e s t e r 
 
 R e t u r n 
 
 
 
 
 
 ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '                         I n i t P o s i t i o n s 
 
 ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   I n i t P o s i t i o n s 
 
 	 S l o t ( S l o t _ D e s t i n a t i o n 1 )   =   1 7 1   *   4 0 9 6   /   3 6 0 
 
 	 G o s u b   W a i t A l l M o t o r s 
 
 R e t u r n 
 
 
 
 L a b e l   C h e c k M o t o r T e m p e r a t u r e 
 
 	 V a r i a b l e   N u m e r i c   O l d T e m p e r a t u r e 
 
 	 G o s u b   T e s t M o t o r s T e m p e r a t u r e 
 
 	 I f   M o t o r s T e m p e r a t u r e   < >   O l d T e m p e r a t u r e 
 
 	 	 O l d T e m p e r a t u r e   =   M o t o r s T e m p e r a t u r e 
 
 	 	 B u t t o n   M o t o r T e m p   T e x t   " M o t o r T e m p :   "   +   F o r m a t ( M o t o r s T e m p e r a t u r e ,   " 0 " ) 
 
 	 	 I f   M o t o r s T e m p e r a t u r e   >   5 5 
 
 	 	 	 F o r   v 1   =   1   T o   1 0 
 
 	 	 	 	 L o a d   S o u n d \ A l a r m 1 4 . w a v 
 
 	 	 	 	 W a i t   N o t   M e d i a P l a y i n g 
 
 	 	 	 N e x t 
 
 	 	 	 S t o p 
 
 	 	 E n d I f 
 
 	 E n d I f 
 
 R e t u r n 
 
 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     V A R I A B L E S 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V a r i a b l e   N u m e r i c   S l o t _ L e d R 
 
 V a r i a b l e   N u m e r i c   S l o t _ L e d G 
 
 V a r i a b l e   N u m e r i c   S l o t _ L e d B 
 
 
 
 V a r i a b l e   N u m e r i c   S l o t _ S i g n a l S c o p e 
 
 
 
 V a r i a b l e   N u m e r i c   S l o t _ P E N 
 
 V a r i a b l e   N u m e r i c   S l o t _ S o l e n o i d V o l t a g e 
 
 V a r i a b l e   N u m e r i c   S l o t _ E m e r g e n c y 
 
 V a r i a b l e   N u m e r i c   S l o t _ P a u s e 
 
 V a r i a b l e   N u m e r i c   S l o t _ P i v o t 
 
 V a r i a b l e   N u m e r i c   S l o t _ R u n _ S i g n a l S c o p e _ B T 
 
 
 
 
 
 V a r i a b l e   N u m e r i c   P e n D o w n _ V a l u e 
 
 V a r i a b l e   N u m e r i c   P e n U p _ V a l u e 
 
 
 
 V a r i a b l e   N u m e r i c   R m a x 
 
 V a r i a b l e   N u m e r i c   R m i n 
 
 V a r i a b l e   N u m e r i c   C o e f f _ N M 
 
 
 
 V a r i a b l e   N u m e r i c   T o r q u e L i m i t M 1 
 
 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     S L O T S 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   S e t S l o t s 
 
 	 S l o t _ P E N                                 =       6   '   T h e   S e r v o M o t o r   t h a t   c o n t r o l s   t h e   p e n 
 
 	 S l o t _ S o l e n o i d V o l t a g e         =       2   '   T h e   s o l e n o i d   v o l t a g e   1 0 0 0   =   + 4 V   /   - 1 0 0 0   =   - 4 V 
 
 	 S l o t _ P i v o t                             =     1 0   '   P i v o t   o u t   l e v e l   h i g h 
 
 	 S l o t _ R u n _ S i g n a l S c o p e _ B T   =     1 3 
 
 	 
 
 	 S l o t _ L e d R                               =   9 0 7 
 
 	 S l o t _ L e d G                               =   9 0 8 
 
 	 S l o t _ L e d B                               =   9 0 9 
 
 	 
 
 	 S l o t _ E m e r g e n c y                     =   9 1 1 
 
 	 S l o t _ P a u s e                             =   9 1 2 
 
 	 S l o t _ S i g n a l S c o p e                 =   9 1 4 
 
 R e t u r n 
 
 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     E M E R G E N C Y 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   E m e r g e n c y 
 
 	 G o s u b   D i s a b l e A l l B u t t o n s 
 
 	 B u t t o n   1 5   E n a b l e d 
 
 	 B u t t o n   1 5   C o l o r   F l a s h i n g 7   Y e l l o w   R e d 
 
 	 F o r   v 1   =   1   T o   9 e 9 9 
 
 	 	 G o s u b   R e d O n 
 
 	 	 W a i t   S e c o n d s   0 . 4 
 
 	 	 G o s u b   R g b O f f 
 
 	 	 W a i t   S e c o n d s   0 . 4 
 
 	 	 L o a d   s o u n d \ A l a r m 1 0 b . w a v 
 
 	 N e x t 
 
 S t o p 
 
 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     E N A B L E / D I S A B L E   B U T T O N S 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   E n a b l e A l l B u t t o n s 
 
 	 F o r   v 1   =   1   T o   3 2 
 
 	 	 B u t t o n   v 1   E n a b l e d 
 
 	 N e x t 
 
 R e t u r n 
 
 
 
 L a b e l   D i s a b l e A l l B u t t o n s 
 
 	 F o r   v 1   =   1   T o   3 2 
 
 	 	 B u t t o n   v 1   D i s a b l e d 
 
 	 N e x t 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     C L O S I N G   E V E N T S 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   C l o s e A l l 
 
 	 G o s u b   S a v e V a r s A n d P o s i t i o n s 
 
 	 L o a d   C l o s e A p p s   T h e r e m i n o _ E d i t o r 
 
 	 L o a d   C l o s e A p p s 
 
 R e t u r n 
 
 
 
 L a b e l   E v e n t S t o p 
 
 	 G o s u b   S a v e V a r s A n d P o s i t i o n s 
 
 	 G o s u b   E n a b l e A l l B u t t o n s 
 
 	 W i n d o w   S i z a b l e 
 
 	 S l o t ( S l o t _ S i g n a l S c o p e )   =   0 
 
 E n d 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     S A V E   L O A D   a n d   C L E A R   V A R S   a n d   P O S I T I O N S 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   S a v e V a r s A n d P o s i t i o n s 
 
 	 v 1   =   N u m C y c l e 
 
 	 v 2   =   E r r o r N u m b e r 
 
 	 S 1   =   S e q u e n c e N a m e 
 
 	 S 2   =   L o g N a m e 
 
 	 S a v e   V a r s 
 
 R e t u r n 
 
 
 
 L a b e l   R e s t o r e V a r s A n d P o s i t i o n s 
 
 	 L o a d   V a r s 
 
 	 N u m C y c l e   =   v 1 
 
 	 E r r o r N u m b e r   =   v 2 
 
 	 S e q u e n c e N a m e   =   S 1 
 
 	 L o g N a m e   =   S 2 
 
 R e t u r n 
 
 
 
 L a b e l   C l e a r V a r s 
 
 	 N u m C y c l e   =   0 
 
 	 E r r o r N u m b e r   =   0 
 
 R e t u r n 
 
 
 
 L a b e l   R e s e t L o g C o u n t e r 
 
 	 G o s u b   C l e a r V a r s 
 
 R e t u r n 
 
 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     P E N   U P / D O W N 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   P e n U p 
 
 	 S l o t ( S l o t _ P E N )   =   P e n U p _ V a l u e 
 
 	 W a i t   S e c o n d s   0 . 1 
 
 R e t u r n 
 
 
 
 L a b e l   P e n D o w n 
 
 	 S l o t ( S l o t _ P E N )   =   P e n D o w n _ V a l u e 
 
 	 W a i t   S e c o n d s   0 . 1 
 
 R e t u r n 
 
 
 
 L a b e l   P e n S i n g l e 
 
 	 G o s u b   W h i t e O n 
 
 	 G o s u b   P e n D o w n 
 
 	 L o a d   s o u n d \ C l i c k 3 . w a v 
 
 	 ' L o a d   " m e d i a \ s o u n d \ l a s e r . w a v " 
 
 	 W a i t   S e c o n d s   0 . 5 
 
 	 G o s u b   P e n U p 
 
 	 G o s u b   G r e e n O n 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     L E D   C O L O R S 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   R e d O n 
 
 	 S l o t   S l o t _ L e d R   =   1 0 0 0 
 
 	 S l o t   S l o t _ L e d G   =   0 
 
 	 S l o t   S l o t _ L e d B   =   0 
 
 R e t u r n 
 
 
 
 L a b e l   M a g e n t a O n 
 
 	 S l o t   S l o t _ L e d R   =   1 0 0 0 
 
 	 S l o t   S l o t _ L e d G   =   0 
 
 	 S l o t   S l o t _ L e d B   =   1 0 0 0 
 
 R e t u r n 
 
 
 
 L a b e l   Y e l l o w O n 
 
 	 S l o t   S l o t _ L e d R   =   9 0 0 
 
 	 S l o t   S l o t _ L e d G   =   4 0 0 
 
 	 S l o t   S l o t _ L e d B   =   0 
 
 R e t u r n 
 
 
 
 L a b e l   G r e e n O n 
 
 	 S l o t   S l o t _ L e d R   =   0 
 
 	 S l o t   S l o t _ L e d G   =   1 0 0 0 
 
 	 S l o t   S l o t _ L e d B   =   0 
 
 R e t u r n 
 
 
 
 L a b e l   B l u e O n 
 
 	 S l o t   S l o t _ L e d R   =   0 
 
 	 S l o t   S l o t _ L e d G   =   0 
 
 	 S l o t   S l o t _ L e d B   =   1 0 0 0 
 
 R e t u r n 
 
 
 
 L a b e l   W h i t e O n 
 
 	 S l o t   S l o t _ L e d R   =   1 0 0 0 
 
 	 S l o t   S l o t _ L e d G   =   1 0 0 0 
 
 	 S l o t   S l o t _ L e d B   =   1 0 0 0 
 
 R e t u r n 
 
 
 
 L a b e l   R g b O f f 
 
 	 S l o t   S l o t _ L e d R   =   0 
 
 	 S l o t   S l o t _ L e d G   =   0 
 
 	 S l o t   S l o t _ L e d B   =   0 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     S E Q U E N C E S 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   I n i t S e q u e n c e P a t h s 
 
 	 V a r i a b l e   S t r i n g   E d i t o r F o l d e r 
 
 	 V a r i a b l e   S t r i n g   E d i t o r A p p 
 
 	 V a r i a b l e   S t r i n g   S e q u e n c e P a t h A n d N a m e 
 
 	 V a r i a b l e   S t r i n g   S e q u e n c e N a m e 
 
 	 ' 
 
 	 E d i t o r F o l d e r   =   " . \ T h e r e m i n o _ H A L \ T h e r e m i n o _ E d i t o r \ " 
 
 	 ' 
 
 	 E d i t o r A p p   =   E d i t o r F o l d e r   +   " T h e r e m i n o _ E d i t o r . e x e " 
 
 	 ' 
 
 	 S e q u e n c e P a t h A n d N a m e   =   E d i t o r F o l d e r   +   " S e q u e n c e s \ "   +   S e q u e n c e N a m e 
 
 R e t u r n 
 
 
 
 L a b e l   E d i t S e q u e n c e 
 
 	 G o s u b   I n i t S e q u e n c e P a t h s 
 
 	 I f   F i l e E x i s t s ( S e q u e n c e P a t h A n d N a m e ) 
 
 	 	 L o a d   E d i t o r A p p   +   "   "   +   S e q u e n c e P a t h A n d N a m e 
 
 	 E n d I f 
 
 R e t u r n 
 
 
 
 L a b e l   S e l e c t S e q u e n c e 
 
 	 G o s u b   I n i t S e q u e n c e P a t h s 
 
 	 s 1   =   S e l e c t F i l e ( E d i t o r F o l d e r   +   " S e q u e n c e s \ " ) 
 
 	 I f   s 1   < >   " " 
 
 	 	 S e q u e n c e N a m e   =   s 1 
 
 	 	 L o g N a m e   =   " F i l e s \ L o g s \ "   +   R e p l a c e ( S e q u e n c e N a m e ,   " . s e q " ,   " . t x t " ) 
 
 	 	 G o s u b   S h o w S e q u e n c e N a m e 
 
 	 E n d I f 
 
 R e t u r n 
 
 
 
 L a b e l   S h o w S e q u e n c e N a m e 
 
 	 B u t t o n   S e l e c t S e q u e n c e   T e x t   " S e q u e n c e "   +   C R L F   +   S e q u e n c e N a m e 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     R U N   s e q u e n c e 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   R u n S e q u e n c e 
 
 	 G o s u b   D i s a b l e A l l B u t t o n s 
 
 	 B u t t o n   E d i t S e q u e n c e   E n a b l e d 
 
 	 B u t t o n   O p e n L o g f i l e   E n a b l e d 
 
 	 B u t t o n   C l o s e A l l   E n a b l e d 
 
 	 B u t t o n   E m e r g e n c y   E n a b l e d 
 
 	 B u t t o n   M 1   E n a b l e d 
 
 	 B u t t o n   m o t o r t e m p   E n a b l e d 
 
 	 ' 
 
 	 S l o t ( S l o t _ R u n _ S i g n a l S c o p e _ B T )   =   1 0 0 0 
 
 	 C o n t r o l s   O p e n T e x t B o x 
 
 	 S t a r t T i m e   =   E l a p s e d T i m e 
 
 	 G o s u b   I n i t S e q u e n c e P a t h s 
 
 	 G o s u b   I n i t F i l e H e a d e r 
 
 	 ' 
 
 	 S e q u e n c e T o E x e c u t e   =   S e q u e n c e P a t h A n d N a m e 
 
 	 F o r   N u m C y c l e   =   N u m C y c l e   T o   I n f i n i t y 
 
 	 	 S l o t ( S l o t _ S i g n a l S c o p e )   =   1 0 0 0 
 
 	 	 R e s u l t   =   " " 
 
 	 	 M a x T o r q u e M 1   =   0 
 
 	 	 G o s u b   E x e c S e q u e n c e 
 
 	 	 G o s u b   U p d a t e L o g 
 
 	 	 S l o t ( S l o t _ S i g n a l S c o p e )   =   0 
 
 	 	 W a i t   S e c o n d s   0 . 5 
 
 	 N e x t 
 
 	 S l o t ( S l o t _ R u n _ S i g n a l S c o p e _ B T )   =   0 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     S E Q U E N C E   L O A D I N G   A N D   E X E C U T I O N 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V a r i a b l e   S t r i n g   S e q u e n c e T o E x e c u t e 
 
 V a r i a b l e   S t r i n g   S e q u e n c e 
 
 V a r i a b l e   S t r i n g   S e q u e n c e C m d 
 
 V a r i a b l e   N u m e r i c   S e q u e n c e I n d e x 
 
 V a r i a b l e   N u m e r i c   S e q u e n c e L e n g t h 
 
 
 
 L a b e l   E x e c S e q u e n c e 
 
 	 L o a d   S e q u e n c e   S e q u e n c e F i l e N a m e 
 
 	 I f   L e n ( S e q u e n c e )   =   0 
 
 	 	 C o n t r o l s   O p e n T e x t B o x 
 
 	 	 P r i n t   C R L F   +   "   S e q u e n c e   f i l e   n o t   f o u n d :   "   +   S e q u e n c e T o E x e c u t e 
 
 	 	 B e e p 
 
 	 	 S t o p 
 
 	 E n d I f 
 
 	 ' 
 
 	 V a r i a b l e   N u m e r i c   E x e c S e q u e n c e S t a r t T i m e 
 
 	 E x e c S e q u e n c e S t a r t T i m e   =   E l a p s e d T i m e 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 	 S e q u e n c e L e n g t h   =   G e t S e p a r a t e d S t r i n g C o u n t ( S e q u e n c e ,   C R L F ) 
 
 	 F o r   S e q u e n c e I n d e x   =   0   T o   S e q u e n c e L e n g t h - 1 
 
 	 	 S e q u e n c e C m d   =   G e t S e p a r a t e d S t r i n g ( S e q u e n c e ,   S e q u e n c e I n d e x ,   C R L F ) 
 
 	 	 S e q u e n c e C m d   =   R e p l a c e ( S e q u e n c e C m d ,   C h r ( 9 ) ,   "   " )   ' T A B S   t o   S P A C E S 
 
 	 	 S e q u e n c e C m d   =   R e m o v e C o m m e n t s ( S e q u e n c e C m d ) 
 
 	 	 S e q u e n c e C m d   =   T r i m ( S e q u e n c e C m d ) 
 
 	 	 ' 
 
 	 	 I f   S e q u e n c e C m d   < >   " " 
 
 	 	 	 P r i n t   "   E x e c u t i n g   c o m m a n d :   "   +   S e q u e n c e C m d   +   C R L F 
 
 	 	 	 ' 
 
 	 	 	 S e l e c t   S e q u e n c e C m d 
 
                         	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   E n d   s e q u e n c e 
 
 	 	 	 	 C a s e   " E n d S e q " 
 
 	 	 	 	 	 S e q u e n c e I n d e x   =   S e q u e n c e L e n g t h - 1 
 
 	 	         	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   A C T I O N S 
 
 	 	 	 	 C a s e   " E n a b l e M o t o r s "           '   e n a b l e   m o v e m e n t   m o t o r s 
 
 	 	 	 	 	 G o s u b   E n a b l e M o t o r s 
 
 	 	 	 	 C a s e   " D i s a b l e M o t o r s "         '   d i s a b l e   m o v e m e n t   m o t o r s 
 
 	 	 	 	 	 G o s u b   D i s a b l e M o t o r s 
 
 	 	 	 	 C a s e   " W a i t A l l M o t o r s " 
 
 	 	 	 	 	 G o s u b   W a i t A l l M o t o r s 
 
 	 	 	 	 C a s e   " C l o s e A l l " 
 
 	 	 	 	 	 G o s u b   C l o s e A l l 
 
 	 	 	 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   P I S T O N S 
 
 	 	 	 	 C a s e   " W a i t P i s t o n I n " 
 
 	 	 	 	 	 G o s u b   W a i t P i s t o n I n 
 
 	 	 	 	 C a s e   " W a i t P i s t o n O u t " 
 
 	 	 	 	 	 G o s u b   W a i t P i s t o n O u t 
 
 	 	 	 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   L E D   C O L O R S 
 
 	 	 	 	 C a s e   " R e d O N " 
 
 	 	 	 	 	 G o s u b   R e d O n 
 
 	 	 	 	 C a s e   " M a g e n t a O N " 
 
 	 	 	 	 	 G o s u b   M a g e n t a O n 
 
 	 	 	 	 C a s e   " Y e l l o w O N " 
 
 	 	 	 	 	 G o s u b   Y e l l o w O n 
 
 	 	 	 	 C a s e   " G r e e n O N " 
 
 	 	 	 	 	 G o s u b   G r e e n O n 
 
 	 	 	 	 C a s e   " B l u e O n " 
 
 	 	 	 	 	 G o s u b   B l u e O n 
 
 	 	 	 	 C a s e   " W h i t e O n " 
 
 	 	 	 	 	 G o s u b   W h i t e O n 
 
 	 	 	 	 C a s e   " R g b O F F " 
 
 	 	 	 	 	 G o s u b   R g b O f f 
 
 	 	 	 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   P e n   a c t i o n s 
 
 	 	 	 	 C a s e   " P e n U p "                         '   m o v e   p e n   u p 
 
 	 	 	 	 	 G o s u b   P e n U p 
 
 	 	 	 	 C a s e   " P e n D o w n "                     '   m o v e   p e n   d o w n 
 
 	 	 	 	 	 G o s u b   P e n D o w n 
 
 	 	 	 	 C a s e   " P e n S i n g l e "                 '   s i n g l e   c l i c k 
 
 	 	 	 	 	 G o s u b   P e n S i n g l e 
 
 	 	 	 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   W i t h   p a r a m e t e r s 
 
 	 	 	 	 C a s e E l s e 
 
 	 	 	 	 	 s 1   =   G e t S e p a r a t e d S t r i n g ( S e q u e n c e C m d ,   0 ) 
 
 	 	 	 	 	 S e l e c t   s 1 
 
 	 	 	 	 	 	 C a s e   " M o v e M o t 1 " 
 
 	 	 	 	 	 	 	 v 1   =     G e t S e p a r a t e d S t r i n g ( S e q u e n c e C m d ,   1 ) 
 
 	 	 	 	 	 	 	 S l o t ( S l o t _ D e s t i n a t i o n 1 )   =   v 1   *   4 0 9 6   /   3 6 0 
 
 	 	 	 	 	 	 ' 
 
 	 	 	 	 	 	 C a s e   " P e n S i n g l e A n d W a i t S o l e n o i d O N " 
 
 	 	 	 	 	 	 	 T e s t V o l t _ T i m e S e c   =   G e t S e p a r a t e d S t r i n g ( S e q u e n c e C m d ,   1 ) 
 
 	 	 	 	 	 	 	 G o s u b   P e n S i n g l e A n d W a i t S o l e n o i d O N 
 
 	 	 	 	 	 	 C a s e   " W a i t S o l e n o i d O F F " 
 
 	 	 	 	 	 	 	 T e s t V o l t _ T i m e S e c   =   G e t S e p a r a t e d S t r i n g ( S e q u e n c e C m d ,   1 ) 
 
 	 	 	 	 	 	 	 G o s u b   W a i t S o l e n o i d O F F 
 
 	 	 	 	 	 	 C a s e   " W a i t S e c u r i t y O N " 
 
 	 	 	 	 	 	 	 T e s t V o l t _ T i m e S e c   =   G e t S e p a r a t e d S t r i n g ( S e q u e n c e C m d ,   1 ) 
 
 	 	 	 	 	 	 	 G o s u b   W a i t S e c u r i t y O N 
 
 	 	 	 	 	 	 C a s e   " W a i t S e c u r i t y O F F " 
 
 	 	 	 	 	 	 	 T e s t V o l t _ T i m e S e c   =   G e t S e p a r a t e d S t r i n g ( S e q u e n c e C m d ,   1 ) 
 
 	 	 	 	 	 	 	 G o s u b   W a i t S e c u r i t y O F F 
 
 	 	 	 	 	 	 ' 
 
 	 	 	 	 	 	 C a s e   " P a u s e " 
 
 	 	 	 	 	 	 	 W a i t   S e c o n d s   G e t S e p a r a t e d S t r i n g ( S e q u e n c e C m d ,   1 ) 
 
 	 	 	 	 	 	 C a s e   " S i g n a l S c o p e " 
 
 	 	 	 	 	 	 	 S l o t ( S l o t _ S i g n a l S c o p e )   =   G e t S e p a r a t e d S t r i n g ( S e q u e n c e C m d ,   1 ) 
 
 	 	 	 	 	 	 ' 
 
 	 	 	 	 	 	 C a s e   " T o r q u e L i m i t M 1 " 
 
 	 	 	 	 	 	 	 T o r q u e L i m i t M 1   =   G e t S e p a r a t e d S t r i n g ( S e q u e n c e C m d ,   1 ) 
 
 	 	 	 	 	 	 C a s e E l s e 
 
 	 	 	 	 	 	 	 I f   s 1   < >   " " 
 
 	 	 	 	 	 	 	 	 C o n t r o l s   O p e n T e x t B o x 
 
 	 	 	 	 	 	 	 	 P r i n t   C R L F   +   "   U n r e c o g n i z e d   c o m m a n d :   "   +   S e q u e n c e C m d   +   C R L F 
 
 	 	 	 	 	 	 	 	 B e e p 
 
 	 	 	 	 	 	 	 	 S t o p 
 
 	 	 	 	 	 	 	 E n d I f 
 
 	 	 	 	 	 E n d S e l e c t 
 
 	 	 	 E n d S e l e c t 
 
 	 	 	 G o s u b   U p d a t e B u t t o n s 
 
 	 	 E n d I f 
 
 	 N e x t 
 
 	 P r i n t   S e q u e n c e T o E x e c u t e   +   "   e x e c u t e d   i n   "   +   F o r m a t ( E l a p s e d T i m e   -   E x e c S e q u e n c e S t a r t T i m e ,   " 0 . 0 0 " )   +   "   s e c o n d s "   +   C R L F 
 
 R e t u r n 
 
 
 
 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '       P R I N T   L O G 
 
 ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V a r i a b l e   S t r i n g   L o g N a m e 
 
 V a r i a b l e   S t r i n g   F i l e H e a d e r 
 
 V a r i a b l e   N u m e r i c   N u m C y c l e 
 
 V a r i a b l e   N u m e r i c   E r r o r N u m b e r 
 
 V a r i a b l e   S t r i n g     R e s u l t 
 
 
 
 L a b e l   O p e n L o g f i l e 
 
 	 L o a d   L o g N a m e 
 
 R e t u r n 
 
 
 
 L a b e l   I n i t F i l e H e a d e r 
 
 	 F i l e H e a d e r   =   C R L F 
 
 	 F i l e H e a d e r   =   F i l e H e a d e r   +   "         T E S T   R O B O T   W 1           N u m     D u r a t .                   "   +   C R L F 
 
 	 F i l e H e a d e r   =   F i l e H e a d e r   +   "         D a t e           T i m e         C y c l e     s e c .       R E S U L T   "   +   C R L F 
 
 	 F i l e H e a d e r   =   F i l e H e a d e r   +   " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - " 
 
 	 S a v e   S t r i n g T o F i l e   F i l e H e a d e r   L o g N a m e 
 
 R e t u r n 
 
 
 
 V a r i a b l e   S t r i n g   L G 1 
 
 V a r i a b l e   N u m e r i c   S t a r t T i m e 
 
 
 
 L a b e l   U p d a t e L o g 
 
 	 C o n t r o l s   O p e n T e x t B o x 
 
 	 L G 1   =   " " 
 
 	 L G 1   =   L G 1   +   F o r m a t ( N o w ,   " y y y y / M M / d d   H H : m m : s s " ) 
 
 	 L G 1   =   L G 1   +   P a d L e f t ( F o r m a t ( N u m C y c l e ,   " 0 0 0 0 0 " ) ,   7 ) 
 
 	 L G 1   =   L G 1   +   P a d L e f t ( F o r m a t ( E l a p s e d T i m e   -   S t a r t T i m e ,   " 0 . 0 0 " ) ,   6 ) 
 
 	 I f   R e s u l t   < >   " " 
 
 	 	 E r r o r N u m b e r   =   E r r o r N u m b e r   +   1 
 
 	 	 L G 1   =   L G 1   +   "       F A I L   "   +   E r r o r N u m b e r 
 
 	 	 L G 1   =   L G 1   +   "   ( "   +   F o r m a t ( 1 0 0   *   E r r o r N u m b e r   /   N u m C y c l e ,   " 0 . 0 " )   +   " % ) " 
 
 	 	 L G 1   =   C R L F   +   L G 1   +   R e s u l t   +   C R L F 
 
 	 E l s e 
 
 	 	 L G 1   =   L G 1   +   "       P A S S " 
 
 	 E n d I f 
 
 	 S a v e   S t r i n g T o F i l e   L G 1   L o g N a m e 
 
 	 P r i n t   C R L F   +   L G 1   +   C R L F   +   C R L F 
 
 	 S t a r t T i m e   =   E l a p s e d T i m e 
 
 R e t u r n 
 
 
 
 L a b e l   U p d a t e R e s u l t 
 
 	 R e s u l t   =   R e s u l t   +   " M 1 = "   +   F o r m a t ( S l o t ( S l o t _ P o s i t i o n 1 )   *   3 6 0   /   4 0 9 6 ,   " 0 . 0 " )   +   "    " 
 
 R e t u r n 
 
 
 
 L a b e l   U p d a t e R e s u l t T o r q u e 
 
 	 R e s u l t   =   R e s u l t   +   " T o r q u e M a x = "   +   F o r m a t ( M a x T o r q u e M 1 ,   " 0 . 0 " ) 
 
 	 R e s u l t   =   R e s u l t   +   " ( "   +   F o r m a t ( T o r q u e L i m i t M 1 ,   " 0 . 0 " )   +   " ) " 
 
 R e t u r n 
 
 
 
 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     P I S T O N 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   W a i t P i s t o n I n 
 
 	 I f   S l o t ( S l o t _ P i v o t )   >   5 0 0 
 
 	 	 G o s u b   A L A R M 
 
 	 	 R e s u l t   =   R e s u l t   +   C R L F   +   "   N O   P i s t o n - i n           -   " 
 
 	 	 G o s u b   U p d a t e R e s u l t 
 
 	 E n d I f 
 
 R e t u r n 
 
 
 
 L a b e l   W a i t P i s t o n O u t 
 
 	 I f   S l o t ( S l o t _ P i v o t )   <   5 0 0 
 
 	 	 G o s u b   A L A R M 
 
 	 	 R e s u l t   =   R e s u l t   +   C R L F   +   "   N O   P i s t o n - o u t         -   " 
 
 	 	 G o s u b   U p d a t e R e s u l t 
 
 	 E n d I f 
 
 R e t u r n 
 
 
 
 L a b e l   A L A R M 
 
 	 V a r i a b l e   N u m e r i c   A L 
 
 	 F o r   A L   =   1   T o   1 
 
 	 	 G o s u b   R e d O n 
 
 	 	 L o a d   " s o u n d / A l a r m 1 0 b . w a v " 
 
 	 	 W a i t   N o t   M e d i a P l a y i n g 
 
 	 N e x t 
 
 	 M a x T o r q u e M 1   =   0 
 
 R e t u r n 
 
 
 
 V a r i a b l e   N u m e r i c   T e s t V o l t _ T i m e S e c 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     S O L E N O I D 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V a r i a b l e   N u m e r i c   W S 1 
 
 V a r i a b l e   N u m e r i c   W S 2 
 
 
 
 L a b e l   P e n S i n g l e A n d W a i t S o l e n o i d O N 
 
 	 F o r   W S 2   =   1   T o   9 e 9 9 
 
 	 	 ' 
 
 	 	 G o s u b   P e n S i n g l e 
 
 	 	 ' 
 
 	 	 F o r   W S 1   =   1   T o   9 e 9 9 
 
 	 	 	 I f   W S 1   >   T e s t V o l t _ T i m e S e c   *   1 0 	 '   t i m e o u t   1 0   S e c 
 
 	 	 	 	 ' 
 
 	 	 	 	 G o s u b   A L A R M 
 
 	 	 	 	 R e s u l t   =   R e s u l t   +   C R L F   +   "   N O   S o l e n o i d - o n       -   " 
 
 	 	 	 	 G o s u b   U p d a t e R e s u l t 
 
 	 	 	 	 ' 
 
 	 	 	 	 I f   W S 2   <   3 	 	 	 	 	 '   n u m b e r   o f   t r i a l s 
 
 	 	 	 	 	 W S 1   =   9 e 9 9 
 
 	 	 	 	 E l s e 
 
 	 	 	 	 	 W S 1   =   9 e 9 9 
 
 	 	 	 	 	 W S 2   =   9 e 9 9 
 
 	 	 	 	 E n d I f 
 
 	 	 	 E n d I f 
 
 	 	 	 ' 
 
 	 	 	 I f   S l o t ( S l o t _ S o l e n o i d V o l t a g e )   >   7 0 0 
 
 	 	 	 	 W S 1   =   9 e 9 9 
 
 	 	 	 	 W S 2   =   9 e 9 9 	 	 	 ' e x i t   f r o m   t w o   F O R - N E X T   l o o p s 
 
 	 	 	 E n d I f 
 
 	 	 	 ' 
 
 	 	 	 W a i t   S e c o n d s   0 . 1 
 
 	 	 	 ' 
 
 	 	 	 G o s u b   T o r q u e T e s t e r 
 
 	 	 N e x t 
 
 	 N e x t 
 
 R e t u r n 
 
 
 
 L a b e l   W a i t S o l e n o i d O F F 
 
 	 F o r   W S 1   =   1   T o   9 e 9 9 
 
 	 	 I f   W S 1   >   T e s t V o l t _ T i m e S e c   *   1 0 
 
 	 	 	 G o s u b   A L A R M 
 
 	 	 	 R e s u l t   =   R e s u l t   +   C R L F   +   "   N O   S o l e n o i d - o f f     -   " 
 
 	 	 	 G o s u b   U p d a t e R e s u l t 
 
 	 	 	 E x i t 
 
 	 	 E n d I f 
 
 	 	 I f   S l o t ( S l o t _ S o l e n o i d V o l t a g e )   >   4 0 0   A n d   S l o t ( S l o t _ S o l e n o i d V o l t a g e )   <   6 0 0 
 
 	 	 	 E x i t 
 
 	 	 E n d I f 
 
 	 	 W a i t   S e c o n d s   0 . 1 
 
 	 	 G o s u b   T o r q u e T e s t e r 
 
 	 N e x t 
 
 R e t u r n 
 
 
 
 L a b e l   W a i t S e c u r i t y O N 
 
 	 F o r   W S 1   =   1   T o   9 e 9 9 
 
 	 	 I f   W S 1   >   T e s t V o l t _ T i m e S e c   *   1 0 
 
 	 	 	 G o s u b   A L A R M 
 
 	 	 	 R e s u l t   =   R e s u l t   +   C R L F   +   "   N O   S e c u r i t y - o n       -   " 
 
 	 	 	 G o s u b   U p d a t e R e s u l t 
 
 	 	 	 E x i t 
 
 	 	 E n d I f 
 
 	 	 I f   S l o t ( S l o t _ S o l e n o i d V o l t a g e )   <   3 0 0 
 
 	 	 	 E x i t 
 
 	 	 E n d I f 
 
 	 	 W a i t   S e c o n d s   0 . 1 
 
 	 	 G o s u b   T o r q u e T e s t e r 
 
 	 N e x t 
 
 R e t u r n 
 
 
 
 L a b e l   W a i t S e c u r i t y O F F 
 
 	 F o r   W S 1   =   1   T o   9 e 9 9 
 
 	 	 I f   W S 1   >   T e s t V o l t _ T i m e S e c   *   1 0 
 
 	 	 	 G o s u b   A L A R M 
 
 	 	 	 R e s u l t   =   R e s u l t   +   C R L F   +   "   N O   S e c u r i t y - o f f     -   " 
 
 	 	 	 G o s u b   U p d a t e R e s u l t 
 
 	 	 	 E x i t 
 
 	 	 E n d I f 
 
 	 	 I f   S l o t ( S l o t _ S o l e n o i d V o l t a g e )   >   4 0 0   A n d   S l o t ( S l o t _ S o l e n o i d V o l t a g e )   <   6 0 0 
 
 	 	 	 E x i t 
 
 	 	 E n d I f 
 
 	 	 W a i t   S e c o n d s   0 . 1 
 
 	 	 G o s u b   T o r q u e T e s t e r 
 
 	 N e x t 
 
 R e t u r n 
 
 
 
 
 
 ' W A T C H   W S 1 
 
 ' W A T C H   W S 2 
 
 ' W A T C H   S e q u e n c e I n d e x 
 
 ' W A T C H   G e t S e p a r a t e d S t r i n g 
 
 ' E X E C   D e s t X   =   1 2 
 
 