-
Notifications
You must be signed in to change notification settings - Fork 174
/
dummy.go
76 lines (70 loc) · 2.36 KB
/
dummy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package main
import (
"fmt"
"log"
"time"
)
type dummy struct {
//myvar mytype string
}
var d = dummy{
//myvar: make(mytype string),
}
func (d *dummy) run() {
for {
//h.broadcast <- message
log.Print("dummy data")
//h.broadcast <- []byte("dummy data")
time.Sleep(8000 * time.Millisecond)
h.broadcast <- []byte("list")
// open com4 (tinyg)
h.broadcast <- []byte("open com4 115200 tinyg")
time.Sleep(1000 * time.Millisecond)
// send some commands
//h.broadcast <- []byte("send com4 ?\n")
//time.Sleep(3000 * time.Millisecond)
h.broadcast <- []byte("send com4 {\"qr\":\"\"}\n")
h.broadcast <- []byte("send com4 g21 g90\n") // mm
//h.broadcast <- []byte("send com4 {\"qr\":\"\"}\n")
//h.broadcast <- []byte("send com4 {\"sv\":0}\n")
//time.Sleep(3000 * time.Millisecond)
for i := 0.0; i < 10.0; i = i + 0.001 {
h.broadcast <- []byte("send com4 G1 X" + fmt.Sprintf("%.3f", i) + " F100\n")
time.Sleep(10 * time.Millisecond)
}
/*
h.broadcast <- []byte("send com4 G1 X1\n")
h.broadcast <- []byte("send com4 G1 X2\n")
h.broadcast <- []byte("send com4 G1 X3\n")
h.broadcast <- []byte("send com4 G1 X4\n")
h.broadcast <- []byte("send com4 G1 X5\n")
h.broadcast <- []byte("send com4 G1 X6\n")
h.broadcast <- []byte("send com4 G1 X7\n")
h.broadcast <- []byte("send com4 G1 X8\n")
h.broadcast <- []byte("send com4 G1 X9\n")
h.broadcast <- []byte("send com4 G1 X10\n")
h.broadcast <- []byte("send com4 G1 X1\n")
h.broadcast <- []byte("send com4 G1 X2\n")
h.broadcast <- []byte("send com4 G1 X3\n")
h.broadcast <- []byte("send com4 G1 X4\n")
h.broadcast <- []byte("send com4 G1 X5\n")
h.broadcast <- []byte("send com4 G1 X6\n")
h.broadcast <- []byte("send com4 G1 X7\n")
h.broadcast <- []byte("send com4 G1 X8\n")
h.broadcast <- []byte("send com4 G1 X9\n")
h.broadcast <- []byte("send com4 G1 X10\n")
h.broadcast <- []byte("send com4 G1 X1\n")
h.broadcast <- []byte("send com4 G1 X2\n")
h.broadcast <- []byte("send com4 G1 X3\n")
h.broadcast <- []byte("send com4 G1 X4\n")
h.broadcast <- []byte("send com4 G1 X5\n")
h.broadcast <- []byte("send com4 G1 X6\n")
h.broadcast <- []byte("send com4 G1 X7\n")
h.broadcast <- []byte("send com4 G1 X8\n")
h.broadcast <- []byte("send com4 G1 X9\n")
h.broadcast <- []byte("send com4 G1 X10\n")
*/
break
}
log.Println("dummy process exited")
}