You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-13Lines changed: 23 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,17 @@ Start the [server](server/server.py)
22
22
python server/server.py
23
23
```
24
24
25
-
## Demonstrator
25
+
The server tries to detect automatically the COM-port used by the Arduino board, and set up a connection.
26
+
27
+
Then two processes are started:
28
+
29
+
- A process to monitor data sent from the board. This data is used to update the status of LED1, LED2 and BUTTON in variables also available to the other process.
30
+
- A process providing a Flask based API server to access these status variables and also send instructions to the board.
31
+
32
+
The server also hosts an html/javascript based demonstrator environment to test and
33
+
illustrate use of the API.
34
+
35
+
## Test API
26
36
27
37
Go to the [demonstrator](http://localhost:5000/)
28
38
@@ -31,34 +41,34 @@ Go to the [demonstrator](http://localhost:5000/)
31
41
Use buttons LED1 and LED2 to control the leds. The browser displays the status of the
32
42
leds, and also indicates if the button on the board is pushed down.
33
43
34
-
## API
44
+
## Methods API
35
45
36
46
API methods available from this server
37
47
38
48
- GET status
39
49
40
-
curl http://localhost:5000/status
50
+
curl 'http://localhost:5000/status' -X GET
41
51
42
52
- PUT reset
43
53
44
-
curl http://localhost:5000/reset -X PUT
54
+
curl 'http://localhost:5000/reset' -X PUT
45
55
46
56
- GET or PUT status LED1
47
57
48
-
curl http://localhost:5000/led1
49
-
curl http://localhost:5000/led1 -X PUT -H 'Content-Type: application/json' --data '"ON"'
50
-
curl http://localhost:5000/led1 -X PUT -H 'Content-Type: application/json' --data '"OFF"'
51
-
curl http://localhost:5000/led1 -X PUT -H 'Content-Type: application/json' --data '"SWITCH"'
58
+
curl 'http://localhost:5000/led1' -X GET
59
+
curl 'http://localhost:5000/led1' -X PUT -H 'Content-Type: application/json' --data '"ON"'
60
+
curl 'http://localhost:5000/led1' -X PUT -H 'Content-Type: application/json' --data '"OFF"'
61
+
curl 'http://localhost:5000/led1' -X PUT -H 'Content-Type: application/json' --data '"SWITCH"'
52
62
53
63
- GET or PUT status LED2
54
64
55
-
curl http://localhost:5000/led2
56
-
curl http://localhost:5000/led2 -X PUT -H 'Content-Type: application/json' --data '"ON"'
57
-
curl http://localhost:5000/led2 -X PUT -H 'Content-Type: application/json' --data '"OFF"'
58
-
curl http://localhost:5000/led2 -X PUT -H 'Content-Type: application/json' --data '"SWITCH"'
65
+
curl 'http://localhost:5000/led2' -X GET
66
+
curl 'http://localhost:5000/led2' -X PUT -H 'Content-Type: application/json' --data '"ON"'
67
+
curl 'http://localhost:5000/led2' -X PUT -H 'Content-Type: application/json' --data '"OFF"'
68
+
curl 'http://localhost:5000/led2' -X PUT -H 'Content-Type: application/json' --data '"SWITCH"'
0 commit comments