Skip to content

Commit f46a7f8

Browse files
committed
Added details about USB serial communication
1 parent a812e3a commit f46a7f8

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

β€Ž_build/pages/android.markdown

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ The code snippet demonstrates how to use REQUEST to interact with a specified en
229229

230230
These functions allow you to connect, send, and receive data over a USB serial connection.
231231

232-
🔌 Open a USB Serial Connection
232+
#### 🔌 Open a USB Serial Connection
233233

234234
```smallbasic
235235
const usb = android.openUsbSerial(vendorId, [baud], [timeout])
@@ -245,23 +245,23 @@ Returns:
245245

246246
- A USB serial object to be used with other USB functions.
247247

248-
❌ Close the USB Connection
248+
#### ❌ Close the USB Connection
249249

250250
```smallbasic
251251
usb.close()
252252
```
253253

254254
Closes the current USB connection. Always call this when you're done using the device.
255255

256-
📋 Get Device Description
256+
#### 📋 Get Device Description
257257

258258
```smallbasic
259259
usb.description()
260260
```
261261

262262
Returns a string with details about the connected USB device, such as product name or manufacturer info (if available).
263263

264-
📥 Receive Data
264+
#### 📥 Receive Data
265265

266266
```smallbasic
267267
dat = usb.receive()
@@ -273,7 +273,7 @@ Returns:
273273

274274
A string containing the received data, or an empty string if no data is received before timeout.
275275

276-
📤 Send Data
276+
#### 📤 Send Data
277277

278278
```smallbasic
279279
n = usb.send(dat)
@@ -289,7 +289,7 @@ Returns:
289289

290290
The number of bytes successfully sent.
291291

292-
📝 Example
292+
#### 📝 Example
293293

294294
```
295295
import android

β€Žpages/android.html

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ <h2 id="iot-device-communication">IoT Device Communication</h2>
239239
<h3 id="usb-serial-support">USB Serial Support</h3>
240240
<p>These functions allow you to connect, send, and receive data over a
241241
USB serial connection.</p>
242-
<p>πŸ”Œ Open a USB Serial Connection</p>
242+
<h4 id="open-a-usb-serial-connection">πŸ”Œ Open a USB Serial
243+
Connection</h4>
243244
<div class="sourceCode" id="cb15"><pre
244245
class="sourceCode smallbasic"><code class="sourceCode smallbasic"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="dt">const</span> usb = android.openUsbSerial(vendorId, [baud], [timeout])</span></code></pre></div>
245246
<p>Parameters:</p>
@@ -254,32 +255,32 @@ <h3 id="usb-serial-support">USB Serial Support</h3>
254255
<ul>
255256
<li>A USB serial object to be used with other USB functions.</li>
256257
</ul>
257-
<p>❌ Close the USB Connection</p>
258+
<h4 id="close-the-usb-connection">❌ Close the USB Connection</h4>
258259
<div class="sourceCode" id="cb16"><pre
259260
class="sourceCode smallbasic"><code class="sourceCode smallbasic"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a>usb.<span class="fu">close</span>()</span></code></pre></div>
260261
<p>Closes the current USB connection. Always call this when you’re done
261262
using the device.</p>
262-
<p>πŸ“‹ Get Device Description</p>
263+
<h4 id="get-device-description">πŸ“‹ Get Device Description</h4>
263264
<div class="sourceCode" id="cb17"><pre
264265
class="sourceCode smallbasic"><code class="sourceCode smallbasic"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a>usb.description()</span></code></pre></div>
265266
<p>Returns a string with details about the connected USB device, such as
266267
product name or manufacturer info (if available).</p>
267-
<p>πŸ“₯ Receive Data</p>
268+
<h4 id="receive-data">πŸ“₯ Receive Data</h4>
268269
<div class="sourceCode" id="cb18"><pre
269270
class="sourceCode smallbasic"><code class="sourceCode smallbasic"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a>dat = usb.receive()</span></code></pre></div>
270271
<p>Reads incoming data from the connected USB device.</p>
271272
<p>Returns:</p>
272273
<p>A string containing the received data, or an empty string if no data
273274
is received before timeout.</p>
274-
<p>πŸ“€ Send Data</p>
275+
<h4 id="send-data">πŸ“€ Send Data</h4>
275276
<div class="sourceCode" id="cb19"><pre
276277
class="sourceCode smallbasic"><code class="sourceCode smallbasic"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a>n = usb.send(dat)</span></code></pre></div>
277278
<p>Sends data to the connected USB device.</p>
278279
<p>Parameters:</p>
279280
<p>dat – The data to send as a string.</p>
280281
<p>Returns:</p>
281282
<p>The number of bytes successfully sent.</p>
282-
<p>πŸ“ Example</p>
283+
<h4 id="example">πŸ“ Example</h4>
283284
<pre><code>import android
284285
usb = android.openUsbSerial(0x16C0)
285286
while 1
@@ -357,7 +358,7 @@ <h2 id="privacy-policy">Privacy Policy <a
357358
<p><a href="privacy.html">Privacy Policy</a></p>
358359
</div>
359360
<div class="pagefooter">
360-
This page was last edited on Mon, 7 Apr 2025 22:40:38 +0200
361+
This page was last edited on Sun, 20 Apr 2025 08:02:09 +0930
361362
|
362363
<a href="https://en.wikipedia.org/wiki/Markdown" target="_blank" rel="nofollow">Markdown</a>
363364
processed with

0 commit comments

Comments
Β (0)