diff options
author | 2020-08-11 14:17:51 +0800 | |
---|---|---|
committer | 2020-08-11 14:17:51 +0800 | |
commit | 9864f3621afd5b08c68de8f2176c780051426b53 (patch) | |
tree | 1c180de73ce81128fb1fdd47121bc31a201c8634 | |
parent | Add lobotctl for debug instruction bytes (diff) | |
download | lobot-9864f3621afd5b08c68de8f2176c780051426b53.tar.gz lobot-9864f3621afd5b08c68de8f2176c780051426b53.tar.bz2 lobot-9864f3621afd5b08c68de8f2176c780051426b53.zip |
sendInstruction not need values
Signed-off-by: jet tsang zeon-git <zeon-git@jettsang.com>
-rwxr-xr-x | cmd/lobotctl/demo.sh | 29 | ||||
-rw-r--r-- | servo/servo.go | 2 |
2 files changed, 29 insertions, 2 deletions
diff --git a/cmd/lobotctl/demo.sh b/cmd/lobotctl/demo.sh new file mode 100755 index 0000000..abb2304 --- /dev/null +++ b/cmd/lobotctl/demo.sh @@ -0,0 +1,29 @@ +#!/bin/bash +#init +./lobotctl -port /dev/ttyAMA0 -id 2 -instruction MoveTimeWrite -arguments 130,150 +sleep 0.5 + +./lobotctl -port /dev/ttyAMA0 -id 1 -instruction MoveTimeWrite -arguments 200,150 +sleep 0.5 +./lobotctl -port /dev/ttyAMA0 -id 1 -instruction MoveTimeWrite -arguments 280,150 +sleep 0.5 +./lobotctl -port /dev/ttyAMA0 -id 1 -instruction MoveTimeWrite -arguments 200,150 +sleep 0.5 +./lobotctl -port /dev/ttyAMA0 -id 1 -instruction MoveTimeWrite -arguments 280,150 +sleep 0.5 +./lobotctl -port /dev/ttyAMA0 -id 1 -instruction MoveTimeWrite -arguments 0,150 +sleep 0.5 +./lobotctl -port /dev/ttyAMA0 -id 1 -instruction MoveTimeWrite -arguments 280,150 +sleep 0.5 +./lobotctl -port /dev/ttyAMA0 -id 1 -instruction MoveTimeWrite -arguments 380,150 +sleep 0.5 +./lobotctl -port /dev/ttyAMA0 -id 1 -instruction MoveTimeWrite -arguments 280,150 +sleep 0.5 +./lobotctl -port /dev/ttyAMA0 -id 1 -instruction MoveTimeWrite -arguments 380,150 +sleep 0.5 +./lobotctl -port /dev/ttyAMA0 -id 1 -instruction MoveTimeWrite -arguments 0,150 +sleep 0.8 + +./lobotctl -port /dev/ttyAMA0 -id 2 -instruction MoveTimeWrite -arguments 210,150 +sleep 0.2 +./lobotctl -port /dev/ttyAMA0 -id 2 -instruction MoveTimeWrite -arguments 0,150 diff --git a/servo/servo.go b/servo/servo.go index e3f608c..0d10b27 100644 --- a/servo/servo.go +++ b/servo/servo.go @@ -63,8 +63,6 @@ func (s *Servo) sendInstruction(i InstName, values []uint16) error { utils.Low(values[1]), utils.High(values[1]), } - default: - return fmt.Errorf("invalid instruction length: %d", r.Length) } return s.Protocol.WriteData(s.ID, r.InstByte, params) |