This example shows how motors are moved asynchronously:
#!/usr/bin/perl
#
# stepping motor example, amove()
#
use Spectra;
use Motor;
my $m2 = Motor->locate( name => "mot2");
my $pos = $m2->get( position);
my $pos_new = $pos + 2;
#
# start an asynchronous move
#
amove( mot2 => "$pos_new");
while( Spectra::check_motors_moving())
{
print "\033[5;1f MOT2 is at " . $m2->get( position) . "\n";
#
# space bar terminates move
#
if( Spectra::key() == 32)
{
print "\033[2J\033[5;1f Interrupted\n";
Spectra::stop_all_moves();
goto finish;
}
}
#
# backlash correction
#
Spectra::complete_all_moves();
finish: