57 lines
1.2 KiB
ReStructuredText
57 lines
1.2 KiB
ReStructuredText
===================
|
|
CAN Getting Started
|
|
===================
|
|
|
|
Prerequisites
|
|
=============
|
|
|
|
- Python 3.8 or higher
|
|
- icsneopy library installed
|
|
- CAN hardware device connected
|
|
|
|
:download:`Download complete example <../../examples/python/can/can_complete_example.py>`
|
|
|
|
Basic Setup
|
|
===========
|
|
|
|
1. Import the library and discover devices:
|
|
|
|
.. literalinclude:: ../../examples/python/can/can_complete_example.py
|
|
:language: python
|
|
:lines: 11-19
|
|
|
|
2. Configure and open the device:
|
|
|
|
.. literalinclude:: ../../examples/python/can/can_complete_example.py
|
|
:language: python
|
|
:lines: 22-37
|
|
|
|
Transmitting CAN Frames
|
|
========================
|
|
|
|
.. literalinclude:: ../../examples/python/can/can_complete_example.py
|
|
:language: python
|
|
:lines: 40-53
|
|
|
|
Receiving CAN Frames
|
|
=====================
|
|
|
|
.. literalinclude:: ../../examples/python/can/can_complete_example.py
|
|
:language: python
|
|
:lines: 56-72
|
|
|
|
Cleanup and Resource Management
|
|
===============================
|
|
|
|
.. literalinclude:: ../../examples/python/can/can_complete_example.py
|
|
:language: python
|
|
:lines: 75-79
|
|
|
|
Complete Example with Error Handling
|
|
====================================
|
|
|
|
.. literalinclude:: ../../examples/python/can/can_complete_example.py
|
|
:language: python
|
|
:lines: 82-125
|
|
|