当前位置: 首页>>代码示例>>Python>>正文


Python Arduino.close方法代码示例

本文整理汇总了Python中Arduino.Arduino.close方法的典型用法代码示例。如果您正苦于以下问题:Python Arduino.close方法的具体用法?Python Arduino.close怎么用?Python Arduino.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Arduino.Arduino的用法示例。


在下文中一共展示了Arduino.close方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_find

# 需要导入模块: from Arduino import Arduino [as 别名]
# 或者: from Arduino.Arduino import close [as 别名]
 def test_find(self):
     """ Tests auto-connection/board detection. """
     raw_input(
         'Plug in Arduino board w/LED at pin 13, reset, then press enter')
     from Arduino import Arduino
     board = None
     try:
         # This will trigger automatic port resolution.
         board = Arduino(9600)
     finally:
         if board:
             board.close()
开发者ID:0-1-0,项目名称:Python-Arduino-Command-API,代码行数:14,代码来源:test_main.py

示例2: test_open

# 需要导入模块: from Arduino import Arduino [as 别名]
# 或者: from Arduino.Arduino import close [as 别名]
 def test_open(self):
     """ Tests connecting to an explicit port. """
     port = None
     while not port:
         port = raw_input(
             'Plug in Arduino board w/LED at pin 13, reset.\n'\
             'Enter the port where the Arduino is connected, then press enter:')
         if not port:
             print 'You must enter a port.'
     from Arduino import Arduino
     board = None
     try:
         board = Arduino(9600, port=port)
     finally:
         if board:
             board.close()
开发者ID:0-1-0,项目名称:Python-Arduino-Command-API,代码行数:18,代码来源:test_main.py

示例3: str

# 需要导入模块: from Arduino import Arduino [as 别名]
# 或者: from Arduino.Arduino import close [as 别名]
        #print(msg)
        msgList = str(msg).split(' ')
        if msgList[0] == 'note_on':
            channel = msgList[1][8:]
            note = msgList[2][5:]
            velocity = msgList[3][9:]
            delay = msgList[4][5:]
            playList.append([channel, note, velocity])
            timeDelay.append(delay)

pygame.init()
pygame.mixer_music.load('004.MID')  # load midi file with pygame.mixer_music, ready to play
pygame.mixer_music.play()     #play midi music

while True:
    try:
        print("stageA")
        board.digitalWrite(13,"HIGH")
        board.Servos.write(4, 0)
        time.sleep(1)
        print("stageB")
        board.Servos.write(4, 90)
        board.digitalWrite(13,"LOW")
        time.sleep(1)

    except KeyboardInterrupt:
        print("exit...")
        board.close()
        pygame.mixer_music.stop()

        
开发者ID:hotpoor,项目名称:PlayerPiano-mushroomCloud,代码行数:31,代码来源:test2017-06-27.py


注:本文中的Arduino.Arduino.close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。