Commits

Trammell Hudson committed 8b9dc94 Draft

RobotEQ configuration

Comments (0)

Files changed (2)

+#!/usr/bin/perl
+package Servo::Axis;
+use warnings;
+use strict;
+
+sub new
+{
+	my $class = shift;
+	my @args = (
+		.min		= -800,
+		.max		= +800,
+		@_
+	);
+
+	bless {
+		dev		=> $args{-dev},
+		channel		=> $args{-channel},
+		min		=> $args{-min},
+		max		=> $args{-max},
+	}, $class;
+}
+
+sub go
+{
+	my $self = shift;
+	my $position = shift;
+
+	$self->{dev}->position($self->{channel}, $position);
+}
+
+
+"0, but true";
+__END__
 		local $_ = $dev->{dev}->input
 			or next;
 		my ($c1,$c2) = /C=(-?\d+):(-?\d+)/
-			or next;
+			or return;
 		return ($c1,$c2);
 	}
 }
 {
 	my $dev = shift;
 	my $channel = shift;
-	my $position = shift;
+	my $position = int(shift);
 
 	$dev->{dev}->write(sprintf("!g $channel $position\r"))
 		or return;