From ef3186fbfc57d0e4315440479264ffcefa1cc206 Mon Sep 17 00:00:00 2001 From: Adrian Zankich Date: Wed, 19 Nov 2014 15:05:16 -0800 Subject: [PATCH] Remove panic from servo_driver --- platforms/gpio/servo_driver.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platforms/gpio/servo_driver.go b/platforms/gpio/servo_driver.go index b39944a9..c243d833 100644 --- a/platforms/gpio/servo_driver.go +++ b/platforms/gpio/servo_driver.go @@ -1,6 +1,8 @@ package gpio import ( + "errors" + "github.com/hybridgroup/gobot" ) @@ -66,7 +68,7 @@ func (s *ServoDriver) InitServo() (err error) { // Move sets the servo to the specified angle func (s *ServoDriver) Move(angle uint8) (err error) { if !(angle >= 0 && angle <= 180) { - panic("Servo angle must be an integer between 0-180") + return errors.New("Servo angle must be an integer between 0-180") } s.CurrentAngle = angle return s.adaptor().ServoWrite(s.Pin(), s.angleToSpan(angle))