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


Python WConio.kbhit方法代码示例

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


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

示例1: main

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import kbhit [as 别名]
def main():

    USB1208LS=MCCDAQ()

    WConio.clrscr() 
    print "Demonstration of cbDIn()\n"\
           "Press any key to quit.\n\n"\
           "You may change a bit by applying a TTL high or\n"\
           "a TTL low to the corresponding pin# on port A.\n"

    print "The first 7 bits are: pin32 to pin 39\n"\
           "0  1  2  3  4  5  6  7\n "
    (a,a,a,a,a,a,a,a,a,a,row)=WConio.gettextinfo() 
    
    USB1208LS.DConfigPort (0, FIRSTPORTB, DIGITALIN)

    while (WConio.kbhit()==False):
        DataValue=USB1208LS.DIn(0, FIRSTPORTB)
        WConio.gotoxy(0,row)  
        print "Port Value: %d         " %DataValue

        # parse DataValue into bit values to indicate on/off status */
        for I in range (8):
            if (DataValue & 2**I):  BitValue = 1
            else:  BitValue = 0
            print "%d " %BitValue,
开发者ID:countrymarmot,项目名称:mccdaq,代码行数:28,代码来源:ULDI01.py

示例2: main

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import kbhit [as 别名]
def main():
    USB1208LS=MCCDAQ()
    
    WConio.clrscr() 
    print "Demonstration of AIn()\n"\
           "Press any key to quit.\n"

    # get the A/D channel to sample 
    Chan = int ( raw_input('Enter the channel to display: ') )

    print "\nThe raw data value on Channel %u is: " %Chan,
    (a,a,a,a,a,a,a,a,a,col,row)=WConio.gettextinfo() 
    print "\nThe voltage on Channel %u        is: " %Chan,
    
    # collect the sample from the channel until a key is pressed 
    while (WConio.kbhit()==False):
        DataValue=USB1208LS.AIn (0, Chan, BIP5VOLTS)
        EngUnits =USB1208LS.ToEngUnits (0, BIP5VOLTS, DataValue)

        WConio.gotoxy(col,row)  
        print "%5d" %DataValue,
        WConio.gotoxy(col,row+1)  
        print "%.2fV" %EngUnits,
开发者ID:countrymarmot,项目名称:mccdaq,代码行数:25,代码来源:ULAI01.py

示例3: display_once

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import kbhit [as 别名]
        usb, all_servos, analog_channels  = rcs.robust_read('CA0USM', 3)
        firmware_version = usb[2]
        disabled = (all_servos[-1][-1] == -1)

        # Servo and Analog Display Page
        servo_mode = IDLE   # Set up variables for running servos
        command_mode = INIT
        accel_dif = False
        accel_list = [1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 255]
        display_once(firmware_version)      # Display static and initial items

        while True:
            if len(all_servos) == 16: #check for valid servo data
                display_update()
            # 'Q' to quit, otherwise sequence through the servo command modes
            if WConio.kbhit():
                key_num, key_str = WConio.getch()
                if key_str.upper() == 'Q':
                    try:
                        rcs.robust_write('C')  #stop all servos at exit
                        del(rcs)        #close serial port
                    except:
                        pass
                    exit()
                elif command_mode is INIT:
                    command_mode = RUN 
                elif command_mode is RUN:
                    command_mode = BRAKE
                elif command_mode is BRAKE:
                    command_mode = IDLE
                else:
开发者ID:philips,项目名称:feusb,代码行数:33,代码来源:TestRCS.py


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