The following example uses functions:
#!/usr/bin/perl # # stepping motor example, using functions # use Spectra; # # fetch motor parameters # print "\n"; print " Name mot12 \n"; print " Position " . gmup( "mot12") . "\n"; print " Accel " . gma( "mot12") . "\n"; print " Base " . gmb( "mot12") . "\n"; print " Slew " . gms( "mot12") . "\n"; print " Settle time " . gmst( "mot12") . "\n"; print " Unit_backlash " . gmub( "mot12") . "\n"; print " Unit_limit_min " . gmuli( "mot12") . "\n"; print " Unit_limit_max " . gmula( "mot12") . "\n"; print " Ramp_units " . gmru( "mot12") . "\n"; print " Ramp_steps " . gmrs( "mot12") . "\n"; # # change motor parameters # $ret = smb( "mot12", 20); # base rate $ret = sms( "mot12", 50000); # slew rate # # fetch the current positions of mot11 and mot12 # $pos11 = gmup( "mot11"); $pos12 = gmup( "mot12"); # $new_pos11 = $pos11 + 1; $new_pos12 = $pos12 + 1; $ret = move( "mot11" => $new_pos11, "mot12" => $new_pos12); # # single steps movements # $ret = step_up( "mot11", "mot12"); $ret = step_down( "mot11", "mot12"); # # calibration # $ret = calibrate( name => "mot11", unit => 1.234, nolog => 1, # optional, def.: 0 noconfirm => 1, # optional, def.: 0 keeping_limits => 0); # optional, def.: 1
See the section 6.14 for the complete list of motor functions.