Skip to content

Commit

Permalink
fix stepper protocol constants and example
Browse files Browse the repository at this point in the history
  • Loading branch information
ntruchsess committed Mar 4, 2014
1 parent 6c99551 commit 72a9d09
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
14 changes: 8 additions & 6 deletions examples/example_stepper.pl
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@
$device->observe_string( \&onStringMessage, undef );

my $steps = [
[0,100,10],
[1,200,20],
[0,100,40],
[0,1000,5000],
[1,500,5000],
[0,1000,5000],
[1,1500,5000]
];

my $stepperContext = { position => 0, progStep => 0, program => $steps };

$device->observe_stepper( \&onStepperMessage, $stepperContext );
$device->observe_stepper(0, \&onStepperMessage, $stepperContext );

$device->stepper_config(0,'DRIVER',1000,4,5); # $stepperNum, $interface, $stepsPerRev, $directionPin, $stepPin,[$motorPin3, $motorPin4]
#$device->stepper_config(0,'DRIVER',1000,4,5); # $stepperNum, $interface, $stepsPerRev, $directionPin, $stepPin,[$motorPin3, $motorPin4]
#$device->stepper_config(0,'TWO_WIRE',1000,4,5); # $stepperNum, $interface, $stepsPerRev, $directionPin, $stepPin,[$motorPin3, $motorPin4]
#$device->stepper_config(0,'FOUR_WIRE',1000,4,5,6,7); # $stepperNum, $interface, $stepsPerRev, $directionPin, $stepPin,[$motorPin3, $motorPin4]
$device->stepper_config(0,'FOUR_WIRE',64,8,6,5,7); # $stepperNum, $interface, $stepsPerRev, $directionPin, $stepPin,[$motorPin3, $motorPin4]


nextStep($stepperContext,0);

Expand Down
6 changes: 3 additions & 3 deletions lib/Device/Firmata/Protocol.pm
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ our $STEPPER_COMMANDS = {
};

our $STEPPER_INTERFACES = {
DRIVER => 0,
TWO_WIRE => 1,
FOUR_WIRE => 2,
DRIVER => 1,
TWO_WIRE => 2,
FOUR_WIRE => 4,
};

our $ENCODER_COMMANDS = {
Expand Down

0 comments on commit 72a9d09

Please sign in to comment.