aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-11-13 22:17:49 +0100
committerDimitri Sokolyuk <demon@dim13.org>2016-11-13 22:17:49 +0100
commit82d7cd0f7a405e81b06b9dfd47de324d54505618 (patch)
treeea08f05f6439cec456c1aac7d5dfe4fd5b3a624c
parentef18e59ff6088590501d7b67d099c6c5b9a0b354 (diff)
wip
-rw-r--r--plot.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/plot.go b/plot.go
index 01437ee..2d6a684 100644
--- a/plot.go
+++ b/plot.go
@@ -57,12 +57,6 @@ func CuttingArea(p Point) string { return "FU" + p.String() }
func Curve(a int, p ...Point) string { return fmt.Sprintf("Y%d,%v", a, Path(p)) }
-func (r Robo) Version() string {
- r.dev.WriteString("FG")
- resp, _ := r.dev.ReadString()
- return strings.TrimSpace(resp)
-}
-
func (r Robo) Wait4Ready() {
t := time.NewTicker(time.Second)
defer t.Stop()
@@ -88,6 +82,15 @@ func (r Robo) Printf(f string, a ...interface{}) {
r.dev.WriteString(s)
}
+func (r Robo) Scanf(f string, a ...interface{}) string {
+ s := fmt.Sprintf(f, a...)
+ r.dev.WriteString(s)
+ resp, _ := r.dev.ReadString()
+ return strings.TrimSpace(resp)
+}
+
+func (r Robo) Version() string { return r.Scanf("FG") }
+
func (r Robo) GoHome() { r.Printf("TT") }
func (r Robo) Home() { r.Printf("H") }
func (r Robo) Origin() { r.Printf("FJ") }