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


Python pyb.delay函数代码示例

本文整理汇总了Python中pyb.delay函数的典型用法代码示例。如果您正苦于以下问题:Python delay函数的具体用法?Python delay怎么用?Python delay使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: calibrate

def calibrate():
    with open("calibration.txt", "r") as f:
        data = f.read()
        while True:
            print(clear_screen, end="")
            print(data, end="")
            pyb.delay(200)
开发者ID:stoggi,项目名称:microslides,代码行数:7,代码来源:main.py

示例2: testline

def testline( display ) :
  print('testing line')
  displaysize = display.size()
  start = (int(displaysize[0] / 2), int(displaysize[1] / 2))
  px = 0
  py = 0

  def draw(x, y) :
    display.line(start, (x, y), randcolor())

  for x in range(displaysize[0]) :
    draw(px, py)
    px += 1

  for y in range(displaysize[1]) :
    draw(px, py)
    py += 1

  for x in range(displaysize[0]) :
    draw(px, py)
    px -= 1

  for y in range(displaysize[1]) :
    draw(px, py)
    py -= 1
  pyb.delay(2000)
开发者ID:rolandvs,项目名称:GuyCarverMicroPythonCode,代码行数:26,代码来源:tft.py

示例3: test

def test():
    mpu9150 = MPU9150("X")
    testfunc(mpu9150)
    print()
    pyb.delay(250)
    print("Repeating")
    testfunc(mpu9150)
开发者ID:johannes-otto,项目名称:micropython-mpu9x50,代码行数:7,代码来源:magtest.py

示例4: flash

def flash():		# routine to flash blue LED when beat detected

	b_LED.on()

	pyb.delay(30)

	b_LED.off()
开发者ID:Kurtizl,项目名称:Balancing-Robot,代码行数:7,代码来源:milestone3.py

示例5: loop

def loop():
    global mstat,lmstat,mx,lmx,my,lmy,maxX,maxY
    #get a reading from the mouse */
    mouseWrite(0xeb) #  /* give me data! */
    mouseRead()    #  /* ignore ack */
    mstat = mouseRead()
    mx = mouseRead()
    my = mouseRead()

    if((mstat != lmstat) or
       (mx !=lmx) or
       (my != lmy)):
      #/* send the data back up */
      #//Serial.print(mstat, BIN);
        print('X=',str(mx),'\tY=',str(my) + interpretStatByte(mstat))
        lmstat = mstat
        lmx = mx
        lmy = my
        #maxX = max(mx,maxX);
        #maxY = max(my,maxY);
        """
        Serial.print("maxX: ");
        Serial.print(maxX,DEC);
        Serial.print("\tmaxY: ");
        Serial.println(maxY,DEC);
        """
        pyb.delay(20)
开发者ID:P3PO,项目名称:ArduGuitar,代码行数:27,代码来源:psmouse.py

示例6: clear_tastes

def clear_tastes(tastes = ['Y1', 'Y2', 'Y3', 'Y4'], duration = 10000):
	for i in tastes:
		pyb.Pin(i, pyb.Pin.OUT_PP).high()
	pyb.delay(duration)
	for i in tastes:
		pyb.Pin(i, pyb.Pin.OUT_PP).low()
	print('The purge is complete.  This has been the most sucessful purge yet.')
开发者ID:wachutka,项目名称:Blech_Lab,代码行数:7,代码来源:blech_video.py

示例7: uart_hash

def  uart_hash():
	#  initialize UART(6) to output TX on Pin Y1
	uart = UART(6)
	while True:
		uart.init(9600, bits=8, parity = 0, stop = 2)
		uart.writechar(ord('#'))		# letter '#'
		pyb.delay(5)					# delay by 5ms
开发者ID:old-blighty,项目名称:de1-electonics-group-project,代码行数:7,代码来源:full.py

示例8: mainLoop

 def mainLoop(self):
     while True:
         if polling:
             self.pollPollables()
         self.processQ()
         # put a sleep comand here to save energy
         pyb.delay(self.mainLoopDelay)
开发者ID:gratefulfrog,项目名称:ArduGuitar,代码行数:7,代码来源:appT.py

示例9: wait_for_connection

def wait_for_connection():
    print( "wifi.py: wait_for_connection()" )
    global _state
    while not nic().is_connected():
        nic().update()
        pyb.delay(100)
    _state = NICState.CONNECTED
开发者ID:prehensile,项目名称:Mk3-Firmware,代码行数:7,代码来源:wifi.py

示例10: test_6

 def test_6(self):
     t0 = pyb.Timer(0)
     t0.init(freq=1000)
     t0.counter(0)
     pyb.delay(100)
     t0.deinit()
     self.assertGT(t0.counter(), 8, "timer counter")
开发者ID:martinribelotta,项目名称:micropython,代码行数:7,代码来源:TestTimers.py

示例11: run

def run(cName='X7',dName='X8'):
    p = PS2a.PS2(cName,dName)

    mInit(p)

    #setup local loop variabls 
    lmStat = 'y'
    mStat =  'n'
    lmx = '1'
    mx = '0'
    lmy = '1'
    my = '0'

    outputTemplate = 'X=%d\tY=%d\t%s'
    
    while True:
        p.write(0XEB)  # poll
        print('Write POLL')
        p.read()       # ignore the ACK
        mstat = p.read()  # status byte
        mx    = p.read()  # delta-x byte
        my    = p.read()  # delta-y byte

        if mstat != lmstat or mx != lmx or my != lmy:
            print (outputTemplate%(mx,my,interpretStat(mstat)))
            lmstat = mstat
            lmx = mx
            lmy =my
        pyb.delay(20)
开发者ID:P3PO,项目名称:ArduGuitar,代码行数:29,代码来源:ps2m.py

示例12: _communicate

    def _communicate(self, request, number_of_bytes_to_read):
        _checkInt(number_of_bytes_to_read)

        # Sleep to make sure 3.5 character times have passed
        minimum_silent_period   = _calculate_minimum_silent_period(self.serial.get_baudrate())
        pyb.delay(minimum_silent_period)

        # Write request
        self.serial.write(request)


        # Read response
        answer = bytearray()
        timeOutRead = 200
        while True:
            if self.serial.any():
                answer = self.serial.read(number_of_bytes_to_read)
                break
            else:
                pyb.delay(10)
                timeOutRead-=1
                if timeOutRead<=0:
                    break
        #_________                       

        if len(answer) == 0:
            raise Exception('No communication with the instrument (no answer)')

        return answer
开发者ID:ernesto-g,项目名称:micropython,代码行数:29,代码来源:ModBus.py

示例13: lcd_fun

def lcd_fun():
    # Main program block
    lcd = HD44780()

    # Pins 0-5 as above
    lcd.PINS = ['Y1','Y2','Y3','Y4','Y5','Y6']

    # Initialise display
    lcd.init()

    # Use it
    lcd.set_line(0) # First line
    lcd.set_string("ABCDEFGHIJKLMNOP") # Send a string
    lcd.set_line(1) # Second line
    lcd.set_string("1234567890123456") # Again

    pyb.delay(3000) # 3 second delay

    # Send some more
    lcd.set_line(0)
    lcd.set_string("*micropython-lcd")
    lcd.set_line(1)
    lcd.set_string("github.com/wjdp")

    pyb.delay(3000)

    # Done
    lcd.clear()
开发者ID:ffilipus,项目名称:micropython-lcd,代码行数:28,代码来源:example.py

示例14: brake

 def brake( self ) :
   """ Brake the motor by sending power both directions. """
   self._forward.high()
   self._backward.high()
   self._speedControl.pulse_width_percent = 100
   delay(1000)
   self.speed = 0
开发者ID:rolandvs,项目名称:GuyCarverMicroPythonCode,代码行数:7,代码来源:L298N.py

示例15: hal_write_command

 def hal_write_command(self, cmd):
     """Writes a command to the LCD."""
     self.i2c.mem_write(cmd, self.i2c_addr, self.LCD_DDRAM)
     if cmd <= 3:
         # The home and clear commands require a worst
         # case delay of 4.1 msec
         delay(5)
开发者ID:dhylands,项目名称:python_lcd,代码行数:7,代码来源:pyb_i2c_grove_rgb_lcd.py


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