RPi.GPIO

Python.org的PyPI (Python Package Index)

https://pypi.python.org

列出全部可以pip install的package (modules的source code的打包壓縮tar.gz檔)

RPi專用的RPi.GPIO也在其中

https://pypi.python.org/pypi/RPi.GPIO

Note that this module is unsuitable for real-time or timing critical applications. This is because you can not predict when Python will be busy garbage collecting. It also runs under the Linux kernel which is not suitable for real time applications - it is multitasking O/S and another process may be given priority over the CPU, causing jitter in your program. If you are after true real-time performance and predictability, buy yourself an Arduino http://www.arduino.cc !

Note that the current release does not support SPI, I2C, hardware PWM or serial functionality on the RPi yet. This is planned for the near future - watch this space! One-wire functionality is also planned.

Although hardware PWM is not available yet, software PWM is available to use on all channels.

For examples and documentation, visit http://sourceforge.net/p/raspberry-gpio-python/wiki/Home/

點Wiki: Examples再點PWM

https://sourceforge.net/p/raspberry-gpio-python/wiki/PWM/

有可靠的PWM範例

一個PWM物件stop後的頻率會莫名其妙變成1000

motor PWM