在支持Intel®Arduino的板上使用大多数Arduino布线功能的Python模块。
Wiring-x86的Python项目详细描述
wiring-x86是一个python模块,它允许您在 支持Intel®Arduino的板,如:
它提供了一个简单而统一的api(类似于wiringpi模块)来进行对话 到板上的GPIO引脚。
目前,Wiring-x86库支持:
- 正在写入配置为输出的GPIO引脚。
- 从配置为高阻抗输入的GPIO引脚读取。
- 从配置为上拉输入的GPIO引脚读取。
- 从配置为下拉输入的GPIO引脚读取。
- 从配置为模拟输入(ADC)的GPIO引脚读取。
- 写入配置为模拟输出(PWM)的GPIO引脚。
下面是一个简单的示例:
# Import the time module enable sleeps between turning the led on and off.importtime# Import the GPIOEdison class from the wiringx86 module.# In case you want to use a different board, simply the import right class# below. The API is unified for all supported boards.fromwiringx86importGPIOEdisonasGPIO# Create a new instance of the GPIOEdison class.# Setting debug=True gives information about the interaction with sysfs.gpio=GPIO(debug=False)pin=13state=gpio.HIGH# Set pin 13 to be used as an output GPIO pin.print'Setting up pin %d'%pingpio.pinMode(pin,gpio.OUTPUT)print'Blinking pin %d now...'%pintry:while(True):# Write a state to the pin. ON or OFF.gpio.digitalWrite(pin,state)# Toggle the state.state=gpio.LOWifstate==gpio.HIGHelsegpio.HIGH# Sleep for a while.time.sleep(0.5)# When you get tired of seeing the led blinking kill the loop with Ctrl-C.exceptKeyboardInterrupt:# Leave the led turned off.print'\nCleaning up...'gpio.digitalWrite(pin,gpio.LOW)# Do a general cleanup. Calling this function is not mandatory.gpio.cleanup()
完整的文档可以在 wiring-x86 site阅读文档。
必须使用Intel®提供的原始Yocto Linux操作系统。更多 有关如何获取此软件的信息,请转到Intel® Makers site。这个模块只能工作 因为它使用特定的英特尔GPIO 驱动程序sysfs接口。