@@ -239,7 +239,8 @@ <h2 id="iot-device-communication">IoT Device Communication</h2>
239
239
< h3 id ="usb-serial-support "> USB Serial Support</ h3 >
240
240
< p > These functions allow you to connect, send, and receive data over a
241
241
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 >
243
244
< div class ="sourceCode " id ="cb15 "> < pre
244
245
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 >
245
246
< p > Parameters:</ p >
@@ -254,32 +255,32 @@ <h3 id="usb-serial-support">USB Serial Support</h3>
254
255
< ul >
255
256
< li > A USB serial object to be used with other USB functions.</ li >
256
257
</ ul >
257
- < p > β Close the USB Connection</ p >
258
+ < h4 id =" close-the-usb-connection " > β Close the USB Connection</ h4 >
258
259
< div class ="sourceCode " id ="cb16 "> < pre
259
260
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 >
260
261
< p > Closes the current USB connection. Always call this when youβre done
261
262
using the device.</ p >
262
- < p > π Get Device Description</ p >
263
+ < h4 id =" get-device-description " > π Get Device Description</ h4 >
263
264
< div class ="sourceCode " id ="cb17 "> < pre
264
265
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 >
265
266
< p > Returns a string with details about the connected USB device, such as
266
267
product name or manufacturer info (if available).</ p >
267
- < p > π₯ Receive Data</ p >
268
+ < h4 id =" receive-data " > π₯ Receive Data</ h4 >
268
269
< div class ="sourceCode " id ="cb18 "> < pre
269
270
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 >
270
271
< p > Reads incoming data from the connected USB device.</ p >
271
272
< p > Returns:</ p >
272
273
< p > A string containing the received data, or an empty string if no data
273
274
is received before timeout.</ p >
274
- < p > π€ Send Data</ p >
275
+ < h4 id =" send-data " > π€ Send Data</ h4 >
275
276
< div class ="sourceCode " id ="cb19 "> < pre
276
277
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 >
277
278
< p > Sends data to the connected USB device.</ p >
278
279
< p > Parameters:</ p >
279
280
< p > dat β The data to send as a string.</ p >
280
281
< p > Returns:</ p >
281
282
< p > The number of bytes successfully sent.</ p >
282
- < p > π Example</ p >
283
+ < h4 id =" example " > π Example</ h4 >
283
284
< pre > < code > import android
284
285
usb = android.openUsbSerial(0x16C0)
285
286
while 1
@@ -357,7 +358,7 @@ <h2 id="privacy-policy">Privacy Policy <a
357
358
< p > < a href ="privacy.html "> Privacy Policy</ a > </ p >
358
359
</ div >
359
360
< 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
361
362
|
362
363
< a href ="https://en.wikipedia.org/wiki/Markdown " target ="_blank " rel ="nofollow "> Markdown</ a >
363
364
processed with
0 commit comments