#!/usr/bin/perl -w # # MOT1 is moved from 0 to 20000 or from 20000 to 0 while # MOT2 oscillates between 0 and 20 # use strict; use Spectra; my ($pos1, $pos2); gmup( "mot1") < 10000 ? ($pos1 = 20000) : ($pos1 = 0); amove( mot1 => $pos1) or die "Failed to setup MOT1"; while( cm( "mot1")) { gmup( "mot2") < 10 ? ($pos2 = 20) : ($pos2 = 0); saum( "mot2", $pos2) or die " Failed to Saum"; start_move( "mot2") or die " Failed to start_move"; while( Cm( "mot2")) { print "\033[2;1f MOT2 " . gmup( "mot2") . "\033[K\n"; print "\033[3;1f MOT1 " . gmup( "mot1") . "\033[K\n"; Wait( 0.2); if( key() == 32) { stop_move( "mot1"); stop_move( "mot2"); complete_move( "mot2"); print "\033[2;1f MOT2, stopped at " . gmup( "mot2") . "\033[K\n"; goto finish; } } print "\033[2;1f MOT2 before complete " . gmup( "mot2") . "\033[K\n"; complete_move( "mot2"); print "\033[2;1f MOT2, end position: " . gmup( "mot2") . "\033[K\n"; } finish: print "\033[2;1f MOT2 " . gmup( "mot2") . "\033[K\n"; print "\033[3;1f MOT1 " . gmup( "mot1") . "\033[K\n";