File: serial.rst

package info (click to toggle)
python-periphery 2.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 424 kB
  • sloc: python: 3,496; makefile: 21
file content (34 lines) | stat: -rw-r--r-- 631 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Serial
======

Code Example
------------

.. code-block:: python

    from periphery import Serial
    
    # Open /dev/ttyUSB0 with baudrate 115200, and defaults of 8N1, no flow control
    serial = Serial("/dev/ttyUSB0", 115200)
    
    serial.write(b"Hello World!")
    
    # Read up to 128 bytes with 500ms timeout
    buf = serial.read(128, 0.5)
    print("read {:d} bytes: _{:s}_".format(len(buf), buf))
    
    serial.close()

API
---

.. autoclass:: periphery.Serial
    :members:
    :undoc-members:
    :show-inheritance:

.. autoclass:: periphery.SerialError
    :members:
    :undoc-members:
    :show-inheritance: