在支持Intel®Arduino的板上使用大多数Arduino布线功能的Python模块。

Wiring-x86的Python项目详细描述


wiring-x86是一个python模块,它允许您在 支持Intel®Arduino的板,如:

它提供了一个简单而统一的api(类似于wiringpi模块)来进行对话 到板上的GPIO引脚。

https://raw.githubusercontent.com/emutex/wiring-x86/master/docs/source/_images/galileo1.jpg

目前,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接口。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
在Grails中集成javaapplet   动态设置片段时发生java错误   JavaSpringVelocity模板电子邮件?   SpringHateOAS中java自定义json输出   java wait()和notify()相关问题   正则表达式中的单词边界是什么?   使用外部库将项目部署到glassfish后发生java NoClassDefFoundError   java为什么在这里初始化ListNode两次?   java libGDX移动三维模型   java使线程等待另一个线程的执行   正则表达式如何在java中使用正则表达式解析给定字符串   java SWT ScrolledComposite在32768像素后切断画布生成的图像