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


Python board.D18属性代码示例

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


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

示例1: sin_cos_graph

# 需要导入模块: import board [as 别名]
# 或者: from board import D18 [as 别名]
def sin_cos_graph(pixels, pin, func, back_color, front_color):
    if pin != board.D18:
        print('Eyes do not support talk command!')
        return
    if func != math.sin and func != math.cos:
        print('Only sin() and cos() are supported!')
        return
    pixels.fill(back_color)
    t = 0
    for x in range(0, 6):
        y = func(t)
        j = x
        if y >= -1 and y < -0.33:
            i = 0
        elif y >= -0.33 and y < 0.33:
            i = 1
            j = revert_row1[x]
        else:
            i = 2
        c = i * 6 + j
        pixels[c] = front_color
        t += 1.57
    pixels.show() 
开发者ID:sindar,项目名称:pRodriguezAssistant,代码行数:25,代码来源:bender_backlight.py

示例2: __init__

# 需要导入模块: import board [as 别名]
# 或者: from board import D18 [as 别名]
def __init__(self):
        self.PORT = board.D18
        self.NUM = 15
        self.NUMBASE = 5
        self.pixels = neopixel.NeoPixel(self.PORT, self.NUM)
        self.cols = [
            (255, 0, 0),
            (255, 63, 0),
            (255, 120, 0),
            (0, 255, 0),
            (0, 255, 255),
            (0, 0, 255),
            (255, 0, 255)
        ]
        self.col_neutral = (80, 80, 30)
        self.NUMCOLS = len(self.cols)
        self.mode = 1
        self.ORDER = neopixel.GRB
        self.num_pixels = self.NUM
        self.pixels.fill(self.col_neutral)
        self.drinkcolor = (0,0,0)
        self.thr = threading.Thread(target=self.mode3, args=())
        self.thr.start() 
开发者ID:H3c702,项目名称:Hector9000,代码行数:25,代码来源:Simple_LED_Connector.py

示例3: __init__

# 需要导入模块: import board [as 别名]
# 或者: from board import D18 [as 别名]
def __init__(self):
        self.PORT = board.D18
        self.NUM = 15
        self.NUMBASE = 5
        self.pixels = neopixel.NeoPixel(self.PORT, self.NUM)
        self.cols = [
            (255, 0, 0),
            (255, 63, 0),
            (255, 120, 0),
            (0, 255, 0),
            (0, 255, 255),
            (0, 0, 255),
            (255, 0, 255)
        ]
        self.col_neutral = (80, 80, 30)
        self.NUMCOLS = len(self.cols)
        self.mode = 1
        self.ORDER = neopixel.GRB
        self.num_pixels = self.NUM
        self.pixels.fill(self.col_neutral)
        self.drinkcolor = (0,0,0) 
开发者ID:H3c702,项目名称:Hector9000,代码行数:23,代码来源:LEDStripConnector.py

示例4: led_on

# 需要导入模块: import board [as 别名]
# 或者: from board import D18 [as 别名]
def led_on(pin):
    if pin == 1:
        pixels = neopixel.NeoPixel(board.D12, 20)
    elif pin == 2:
        pixels = neopixel.NeoPixel(board.D18, 20)
    else:
        print("wrong id")
        return False
    pixels.fill((255, 255, 255))
    return True 
开发者ID:jeonghoonkang,项目名称:BerePi,代码行数:12,代码来源:led_strip.py

示例5: led_off

# 需要导入模块: import board [as 别名]
# 或者: from board import D18 [as 别名]
def led_off(pin):
    if pin == 1:
        pixels = neopixel.NeoPixel(board.D12, 20)
    elif pin == 2:
        pixels = neopixel.NeoPixel(board.D18, 20)
    else:
        return False
    pixels.fill((0, 0, 0))
    return True 
开发者ID:jeonghoonkang,项目名称:BerePi,代码行数:11,代码来源:led_strip.py

示例6: led_color

# 需要导入模块: import board [as 别名]
# 或者: from board import D18 [as 别名]
def led_color(pin, R=255,G=255,B=255):
    if pin == 1:
        pixels = neopixel.NeoPixel(board.D12, 20)
    elif pin == 2:
        pixels = neopixel.NeoPixel(board.D18, 20)
    else:
        return False
    pixels.fill((R, G, B))
    return True 
开发者ID:jeonghoonkang,项目名称:BerePi,代码行数:11,代码来源:led_strip.py

示例7: talk

# 需要导入模块: import board [as 别名]
# 或者: from board import D18 [as 别名]
def talk(pixels, pin, mode):
    if pin != board.D18:
        print('Eyes do not support talk command!')
        return

    if mode == 'plugged_in':
        back_color = darkorange
        front_color = blue
        period = 0.1
    else:
        back_color = no_color
        front_color = default_color
        period = 0.25

    t = 0
    while t < 30: # maximum answer length to prevent infinite loop
        pixels.fill(back_color)
        for i in range(6, 12):
            pixels[i] = front_color
        pixels.show()
        time.sleep(period)

        sin_cos_graph(pixels, pin, math.cos, back_color, front_color)
        time.sleep(period)

        pixels.fill(back_color)
        for i in range(6, 12):
            pixels[i] = front_color
        pixels.show()
        time.sleep(period)

        sin_cos_graph(pixels, pin, math.sin, back_color, front_color)
        time.sleep(period)
        t += period * 4 
开发者ID:sindar,项目名称:pRodriguezAssistant,代码行数:36,代码来源:bender_backlight.py


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