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


Python uos.uname方法代码示例

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


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

示例1: __init__

# 需要导入模块: import uos [as 别名]
# 或者: from uos import uname [as 别名]
def __init__(self, trigger_pin, echo_pin, echo_timeout_us=500*2*30):
        """
        trigger_pin: Output pin to send pulses
        echo_pin: Readonly pin to measure the distance. The pin should be protected with 1k resistor
        echo_timeout_us: Timeout in microseconds to listen to echo pin.
        By default is based in sensor limit range (4m)
        """
        self.echo_timeout_us = echo_timeout_us
        # Init trigger pin (out)
        self.trigger = Pin(trigger_pin, mode=Pin.OUT)
        self.trigger.value(0)
        # Init echo pin (in)
        if (uname().sysname == 'WiPy'):
            self.echo = Pin(echo_pin, mode=Pin.OPEN_DRAIN)
        else:
            self.echo = Pin(echo_pin, mode=Pin.IN) 
开发者ID:lemariva,项目名称:uPySensors,代码行数:18,代码来源:hcsr04.py

示例2: write_handler

# 需要导入模块: import uos [as 别名]
# 或者: from uos import uname [as 别名]
def write_handler(pin, values):
    if values:
        in_args = values[0].split(' ')
        cmd = in_args[0]
        cmd_args = in_args[1:]

        if cmd == 'help':
            output = ' '.join(CMD_LIST)
        elif cmd == CMD_LIST[0]:
            output = blynklib.LOGO
        elif cmd == CMD_LIST[1]:
            output = blynklib.__version__
        elif cmd == CMD_LIST[2]:
            output = uos.uname()
        elif cmd == CMD_LIST[3]:
            arg = cmd_args[0] if cmd_args else ''
            output = uos.listdir(arg)
        else:
            output = "[ERR]: Not supported command '{}'".format(values[0])

        blynk.virtual_write(pin, output)
        blynk.virtual_write(pin, '\n') 
开发者ID:blynkkk,项目名称:lib-python,代码行数:24,代码来源:02_terminal_cli.py

示例3: Status

# 需要导入模块: import uos [as 别名]
# 或者: from uos import uname [as 别名]
def Status(self, data=None):
        self.destroy()
        self.create_window()
        w = self.window
        y = 10
        gap = 5
        height = 35
        ugfx.Label(10, y, w.width() - 20, height, 'Platform: {}'.format(util.get_version()), parent=w)
        y += gap + height
        ugfx.Label(10, y, w.width() - 20, height, 'Release: {}'.format(uos.uname()[2]), parent=w)
        y += gap + height
        ugfx.Label(10, y, w.width() - 20, height, 'firmware:', parent=w)
        ugfx.set_default_font('IBMPlexMono_Bold18')
        y += height
        ugfx.Label(10, y, w.width() - 20, height + 10, '{}'.format(uos.uname()[3]), parent=w)
        ugfx.set_default_font(self.default_font)
        ugfx.set_default_font('IBMPlexSans_Regular18')
        self.create_status_box()
        ugfx.set_default_font(self.default_font)
        ugfx.input_attach(ugfx.BTN_A, self.__close_status_box)
        try:
            ota_data = ota.check_version()
        except ota.OtaException as e:
            self.set_status('Error: {}'.format(e))
        else:
            if ota_data:
                self.status_box.destroy()
                ugfx.Label(10, 180, 200, 40, text='New: {}'.format(ota_data['version']),
                    parent=w)
                self.btngroup = ButtonGroup(self.window, 190, 180, 110, 40, 10)
                self.btngroup.add('Upgrade', self.install_ota, ota_data)
                self.btngroup.end()
            else:
                self.set_status('Up to date') 
开发者ID:IBM-Developer-Korea,项目名称:developer-badge-2018-apps,代码行数:36,代码来源:launcher.py

示例4: do_acess_point

# 需要导入模块: import uos [as 别名]
# 或者: from uos import uname [as 别名]
def do_acess_point():
    global ap_if
    if uname().machine == 'ESP32 module with ESP32': # Wemos ESP-WROOM-32
        import network
        ap_if = network.WLAN(network.AP_IF)
        ap_if.active(True)
        ap_if.config(essid=access_point_name, authmode=network.AUTH_OPEN)
    elif  uname().machine == 'WiPy with ESP32': # Wipy 2.0
        import pycom
        from network import WLAN
        pycom.heartbeat(False)
        ap_if = WLAN(mode=WLAN.AP, ssid=access_point_name)
    ap_if.ifconfig(('192.168.4.1', '255.255.255.0', '192.168.4.1', '192.168.4.1')) 
开发者ID:lemariva,项目名称:uPyPortal,代码行数:15,代码来源:boot.py

示例5: __init__

# 需要导入模块: import uos [as 别名]
# 或者: from uos import uname [as 别名]
def __init__(self, ledNumber=1, brightness=100, dataPin='P22'):
        """
        Params:
        * ledNumber = count of LEDs
        * brightness = light brightness (integer : 0 to 100%)
        * dataPin = pin to connect data channel (LoPy only)
        """
        self.ledNumber = ledNumber
        self.brightness = brightness

        # Prepare SPI data buffer (8 bytes for each color)
        self.buf_length = self.ledNumber * 3 * 8
        self.buf = bytearray(self.buf_length)

        # SPI init
        # Bus 0, 8MHz => 125 ns by bit, 8 clock cycle when bit transfert+2 clock cycle between each transfert
        # => 125*10=1.25 us required by WS2812
        if uname().sysname == 'LoPy':
            self.spi = SPI(0, SPI.MASTER, baudrate=8000000, polarity=0, phase=1, pins=(None, dataPin, None))
             # Enable pull down
	    Pin(dataPin, mode=Pin.OUT, pull=Pin.PULL_DOWN)
	else: #WiPy
            self.spi = SPI(0, SPI.MASTER, baudrate=8000000, polarity=0, phase=1)
            # Enable pull down
            Pin('GP16', mode=Pin.ALT, pull=Pin.PULL_DOWN)
        
        # Turn LEDs off
        self.show([]) 
开发者ID:Oliv4945,项目名称:wipy-WS2812,代码行数:30,代码来源:ws2812.py

示例6: _send_pulse_and_wait

# 需要导入模块: import uos [as 别名]
# 或者: from uos import uname [as 别名]
def _send_pulse_and_wait(self):
        """
        Send the pulse to trigger and listen on echo pin.
        We use the method `machine.time_pulse_us()` to get the microseconds until the echo is received.
        """
        self.trigger.value(0) # Stabilize the sensor
        time.sleep_us(5)
        self.trigger.value(1)
        # Send a 10us pulse.
        time.sleep_us(10)
        self.trigger.value(0)
        try:
            if (uname().sysname == 'WiPy'):
                pulse_list = pulses_get(self.echo, self.echo_timeout_us)
                if(len(pulse_list) == 0):
                    pulse_time = -1
                else:
                    pulse_time = pulse_list[0][1]
            else:
                pulse_time = time_pulse_us(self.echo, 1, self.echo_timeout_us)

            return pulse_time
        except OSError as ex:
            if ex.args[0] == 110: # 110 = ETIMEDOUT
                raise OSError('Out of range')
            raise ex 
开发者ID:lemariva,项目名称:uPySensors,代码行数:28,代码来源:hcsr04.py


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