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: API.md
+20-20Lines changed: 20 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -115,14 +115,14 @@ the `<key>` parameter.
115
115
* Reboot the camera
116
116
*`http://<IP-ADDRESS>/control?var=reboot&val=0`
117
117
118
-
You can try these yourself in a browser address bar, from the commandline with `curl`
119
-
and co. or use them programatically from your scripting language of choice.
118
+
You can try these yourself in a browser address bar, from the command line with `curl`
119
+
and co. or use them programmatically from your scripting language of choice.
120
120
121
121
## ESP32CAM WebSocket API
122
-
This API is inteded for fast statefull communication between the server and the browser. You can think of a websocket as a state machine, which can be accessed and programmed from the client side, using JavaScript or any other language, which supports Webocket API.
122
+
This API is intended for fast stateful communication between the server and the browser. You can think of a websocket as a state machine, which can be accessed and programmed from the client side, using JavaScript or any other language, which supports Websocket API.
123
123
124
124
In order to use the WebSocket API, you need to open the Websocket first. The url of the websocket is always
125
-
`ws://<your-ip:your-port>/ws`. In Java Script, you simply need to add the followig lines to your page:
125
+
`ws://<your-ip:your-port>/ws`. In Java Script, you simply need to add the following lines to your page:
126
126
127
127
```
128
128
ws = new WebSocket(websocketURL);
@@ -156,26 +156,26 @@ Once the `ws` object is created successfully, you can handle its events on the p
156
156
```
157
157
158
158
Once the websocket is open, you may also send commands and data to the server. Commands are sent with help of the `ws.send(command)` function where the `command` is to be a binary Uint8Array. The first byte of this
159
-
array reflects the command code while the rest of bytes can host addtional parameters of the command.
159
+
array reflects the command code while the rest of bytes can host additional parameters of the command.
160
160
161
161
The following commands are supported:
162
162
163
-
's' - starts the stream. Once the comamand is issued, the server will start pushing the frames to the client
164
-
according to the camera settings. The server will switch to the video mode.
165
-
'p' - similar to the previous command but there will be only one frame taken and pushed to the client. The
166
-
server will swicth to the photo mode.
167
-
'u' - similar to the previous two commands. The server will either start stream or take a still photo,
168
-
depending on the current mode of the server.
169
-
't' - terminates the stream. Only makes sense after 's' or 'u' commands.
170
-
'c' - tells the server that this websocket will be used for PWM control commands.
171
-
'w' - writes the PWM duty value to the pin. This command has additional parameters passed in the bytes of the
172
-
`command` array, as follows:
163
+
-'s' - starts the stream. Once the command is issued, the server will start pushing the frames to the client
164
+
according to the camera settings. The server will switch to the video mode.
165
+
-'p' - similar to the previous command but there will be only one frame taken and pushed to the client. The
166
+
server will switch to the photo mode.
167
+
-'u' - similar to the previous two commands. The server will either start stream or take a still photo,
168
+
depending on the current mode of the server.
169
+
-'t' - terminates the stream. Only makes sense after 's' or 'u' commands.
170
+
-'c' - tells the server that this websocket will be used for PWM control commands.
171
+
-'w' - writes the PWM duty value to the pin. This command has additional parameters passed in the bytes of the
172
+
`command` array, as follows:
173
173
174
174
byte0 - 'w' - code of the command
175
175
byte1 - pin number. If you use the ESP32CAM-DEV board, the available pins are usually limited to 4,
176
176
12, 13 and 33. The 4th pin is connected to the flash lamp so you can control the lamp brightness
177
177
by sending value to this pin via the websocket. Pin 33 is connected to the onboard LED. So, only
178
-
12 and 13 are the ones you can use, provided taht you also use the SD card for storage.
178
+
12 and 13 are the ones you can use, provided that you also use the SD card for storage.
179
179
if you use the internal LittleFS for storage, you may be able to use other pins otherwise
180
180
utilized by the SD card interface.
181
181
byte2 - send 1 for servo mode and 2 for any other PWM.
@@ -205,10 +205,10 @@ GPIO pins used for PWM can be defined in the `/httpd.json`, in the `pwm` paramet
205
205
The `pwm` parameter is defined as a JSON array where each object of the array is a definition of one PWM.
206
206
Attributes of a pwm object are explained below:
207
207
208
-
`pin` - GPIO pin number
209
-
`frequency` - PWM frequency in Herz.
210
-
`resolution` - precision of the PWM (number of bits).
211
-
`default` - initial value of the PWM. if this attribute is not defined, 0 will be used for default.
208
+
-`pin` - GPIO pin number
209
+
-`frequency` - PWM frequency in Herz.
210
+
-`resolution` - precision of the PWM (number of bits).
211
+
-`default` - initial value of the PWM. if this attribute is not defined, 0 will be used for default.
212
212
213
213
if the `lamp` parameter in the httpd config is greater or equal to 0, the 1st element of the pwm array
214
214
will be used for definition of flash lamp PWM. In the example above, the lamp PWM is configured for pin 4
0 commit comments