Browse Source

first commit

master
Bin ohne name geboren 2 years ago
commit
4cdbb6303a
9 changed files with 128 additions and 0 deletions
  1. 34
    0
      Config/HardwareControl.json
  2. 13
    0
      Config/Regal0.json
  3. 13
    0
      Config/Regal1.json
  4. 13
    0
      Config/Regal2.json
  5. 1
    0
      Config/StructContainer.go
  6. 3
    0
      README.md
  7. BIN
      RP2_Pinout.png
  8. BIN
      servertest
  9. 51
    0
      servertest.go

+ 34
- 0
Config/HardwareControl.json View File

@@ -0,0 +1,34 @@
1
+{
2
+	//########################
3
+	//Servo
4
+	//#########################
5
+	"ServoControlBus":1,
6
+	"ServoRollChannel":5,
7
+	"ServoRollMax":500,
8
+	"ServoRollMin":140,
9
+	"ServoRollMid":310,
10
+
11
+	"ServoRotateChannel":14,
12
+	"ServoRotateMax":500,
13
+	"ServoRotateMin":140,
14
+	"ServoRotateMid":307,
15
+
16
+	//########################
17
+	//Sangu-3D-Controller
18
+	//########################
19
+	"3DControlPort":"/dev/ttyUSB0",
20
+	"3DControlCustomLogger":false,
21
+
22
+	//########################
23
+	//Movment Config
24
+	//########################
25
+	"Speed":600,
26
+	"SpeedXOffset":0,
27
+	"SpeedYOffset":0,
28
+	"SpeedZOffset":900,
29
+
30
+	//########################
31
+	//Storage Config
32
+	//########################
33
+	"RegalAnzahl":3
34
+}

+ 13
- 0
Config/Regal0.json View File

@@ -0,0 +1,13 @@
1
+{
2
+    "RegalID":0,
3
+    "ServoRotateOffset":0,
4
+    "RegalstartX":0,       
5
+    "RegalstartY":0,       
6
+    "RegalstartZ":0,       
7
+    "fachary":0,      
8
+    "fachoffset":0,   
9
+    "pickupoffset":0,
10
+    "pickupMove":{"XOffset":0,"YOffset":0},
11
+    "pickupSpeed":{"XspeedOffset":0,"YspeedOffset":0,"ZspeedOffset":0},
12
+    "faecher":[]
13
+}

+ 13
- 0
Config/Regal1.json View File

@@ -0,0 +1,13 @@
1
+{
2
+    "RegalID":1,
3
+    "ServoRotateOffset":0,
4
+    "RegalstartX":0,       
5
+    "RegalstartY":0,       
6
+    "RegalstartZ":0,       
7
+    "fachary":0,      
8
+    "fachoffset":0,   
9
+    "pickupoffset":0,
10
+    "pickupMove":{"XOffset":0,"YOffset":0},
11
+    "pickupSpeed":{"XspeedOffset":0,"YspeedOffset":0,"ZspeedOffset":0},
12
+    "faecher":[]
13
+}

+ 13
- 0
Config/Regal2.json View File

@@ -0,0 +1,13 @@
1
+{
2
+    "RegalID":2,
3
+    "ServoRotateOffset":0,
4
+    "RegalstartX":0,       
5
+    "RegalstartY":0,       
6
+    "RegalstartZ":0,       
7
+    "fachary":0,      
8
+    "fachoffset":0,   
9
+    "pickupoffset":0,
10
+    "pickupMove":{"XOffset":0,"YOffset":0},
11
+    "pickupSpeed":{"XspeedOffset":0,"YspeedOffset":0,"ZspeedOffset":0},
12
+    "faecher":[]
13
+}

+ 1
- 0
Config/StructContainer.go View File

@@ -0,0 +1 @@
1
+package Config

+ 3
- 0
README.md View File

@@ -0,0 +1,3 @@
1
+Complete_Hardware_Control_for everything
2
+----------------------------------------
3
+

BIN
RP2_Pinout.png View File


BIN
servertest View File


+ 51
- 0
servertest.go View File

@@ -0,0 +1,51 @@
1
+package main
2
+
3
+import (
4
+	"fmt"
5
+	"log"
6
+	"net/http"
7
+	"strings"
8
+)
9
+
10
+type httphandlerrework struct {
11
+}
12
+
13
+// formatRequest generates ascii representation of a request
14
+func formatRequest(r *http.Request) string {
15
+	// Create return string
16
+	var request []string
17
+	// Add the request string
18
+	url := fmt.Sprintf("%v %v %v", r.Method, r.URL, r.Proto)
19
+	request = append(request, fmt.Sprintf("%v", r.URL.Query()))
20
+	request = append(request, url)
21
+	// Add the host
22
+	request = append(request, fmt.Sprintf("Host: %v", r.Host))
23
+	// Loop through headers
24
+	for name, headers := range r.Header {
25
+		name = strings.ToLower(name)
26
+		for _, h := range headers {
27
+			request = append(request, fmt.Sprintf("%v: %v", name, h))
28
+		}
29
+	}
30
+
31
+	// If this is a POST, add post data
32
+	if r.Method == "POST" {
33
+		r.ParseForm()
34
+		request = append(request, "\n")
35
+		request = append(request, r.Form.Encode())
36
+	}
37
+	// Return the request as a string
38
+	return strings.Join(request, "\n")
39
+}
40
+
41
+func (h *httphandlerrework) ServeHTTP(writer http.ResponseWriter, req *http.Request) {
42
+	//	fmt.Println("s%", formatRequest(req))
43
+	fmt.Fprint(writer, formatRequest(req))
44
+}
45
+
46
+func main() {
47
+	err := http.ListenAndServe("localhost:33949", &httphandlerrework{}) // set listen port
48
+	if err != nil {
49
+		log.Fatal("ListenAndServe: ", err)
50
+	}
51
+}

Loading…
Cancel
Save