Skip to content

Commit 201f4c2

Browse files
update documentation
1 parent c0360fa commit 201f4c2

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

README.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,17 @@ Start the [server](server/server.py)
2222
python server/server.py
2323
```
2424

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
2636

2737
Go to the [demonstrator](http://localhost:5000/)
2838

@@ -31,34 +41,34 @@ Go to the [demonstrator](http://localhost:5000/)
3141
Use buttons LED1 and LED2 to control the leds. The browser displays the status of the
3242
leds, and also indicates if the button on the board is pushed down.
3343

34-
## API
44+
## Methods API
3545

3646
API methods available from this server
3747

3848
- GET status
3949

40-
curl http://localhost:5000/status
50+
curl 'http://localhost:5000/status' -X GET
4151
4252
- PUT reset
4353

44-
curl http://localhost:5000/reset -X PUT
54+
curl 'http://localhost:5000/reset' -X PUT
4555
4656
- GET or PUT status LED1
4757

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"'
5262
5363
- GET or PUT status LED2
5464

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"'
5969

6070
- GET status BUTTON
6171

62-
curl http://localhost:5000/button
72+
curl 'http://localhost:5000/button' -X GET
6373
6474

0 commit comments

Comments
 (0)