Python Library - Spidev
Python Library - Spidev
com/python-library-spidev/
Het gebruik van software, downloads, scripts en uitleg op deze website is geheel op eigen risico, X
DomoticX is niet aansprakelijk voor de schade die, rechtstreeks of onrechtstreeks het gevolg is van
gebruik van deze website!
OK
Zoeken
Zoek hier …
The closer you look, the less you see!
Informatie (ENG):
Python Spidev
=============
This project contains a python module for interfacing with SPI devices from user space via the
1 of 6 11/10/2022, 1:10 PM
Python Library - spidev http://domoticx.com/python-library-spidev/
Usage
1 ```python
2 import spidev
3 spi = spidev.SpiDev()
4 spi.open(bus, device)
5 to_send = [0x01, 0x02, 0x03]
6 spi.xfer(to_send)
7 ```
Settings
1 ```python
2 import spidev
3 spi = spidev.SpiDev()
4 spi.open(bus, device)
5
6 # Settings (for example)
7 spi.max_speed_hz = 5000
8 spi.mode = 0b01
9 ...
10 ```
* bits_per_word
* cshigh
* loop
* lsbfirst
* max_speed_hz
* mode – SPI mode as two bit pattern of clock polarity and phase [CPOL|CPHA], min: 0b00 =
0, max: 0b11 = 3
* threewire – SI/SO signals shared
Methods
——-
open(bus, device) / Connects to the specified SPI device, opening /dev/spidev-bus.device
2 of 6 11/10/2022, 1:10 PM
Python Library - spidev http://domoticx.com/python-library-spidev/
close()
Disconnects from the SPI device.
Eerst heb je de python DEV dependancies nodig, installeer deze met het commando:
3 of 6 11/10/2022, 1:10 PM
Python Library - spidev http://domoticx.com/python-library-spidev/
wget https://pypi.python.org/packages/source/s/spidev/spidev-3.1.tar.gz
1 --2016-03-06 17:42:15-- https://pypi.python.org/packages/source/s/spidev/spidev-3.1.tar.gz
2 Resolving pypi.python.org (pypi.python.org)... 23.235.43.223
3 Connecting to pypi.python.org (pypi.python.org)|23.235.43.223|:443... connected.
4 HTTP request sent, awaiting response... 200 OK
5 Length: 12583 (12K) [application/octet-stream]
6 Saving to: ‘spidev-3.1.tar.gz’
7
8 spidev-3.1.tar.gz 100%[========================================================>] 12.
9
10 2016-03-06 17:42:15 (61.7 MB/s) - ‘spidev-3.1.tar.gz’ saved [12583/12583]
1 spidev-3.1/
2 spidev-3.1/README.md
3 spidev-3.1/CHANGELOG.md
4 spidev-3.1/setup.py
5 spidev-3.1/spidev_module.c
6 spidev-3.1/PKG-INFO
7 spidev-3.1/LICENSE.md
cd spidev-3.1
1 running install
2 running build
3 running build_ext
4 building 'spidev' extension
5 creating build
6 creating build/temp.linux-armv7l-2.7
4 of 6 11/10/2022, 1:10 PM
Python Library - spidev http://domoticx.com/python-library-spidev/
Changelog
5 of 6 11/10/2022, 1:10 PM
Python Library - spidev http://domoticx.com/python-library-spidev/
Disclaimer: Het gebruik van software, downloads, scripts en uitleg op deze website is geheel op eigen risico en is
bestemd voor educatief gebruik, DomoticX is niet aansprakelijk voor de schade die, rechtstreeks of onrechtstreeks het
gevolg is van gebruik van deze website!
Domotica forum EU Tweakers.net Arduino forum NL Instructables Tindie Thingiverse (3D modellen)
DXF Projects (2D modellen) Arduino Project HUB
6 of 6 11/10/2022, 1:10 PM