Python board.D18 Examples
The following are 7
code examples of board.D18().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
board
, or try the search function
.
Example #1
Source File: bender_backlight.py From pRodriguezAssistant with GNU General Public License v3.0 | 6 votes |
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()
Example #2
Source File: Simple_LED_Connector.py From Hector9000 with MIT License | 6 votes |
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()
Example #3
Source File: LEDStripConnector.py From Hector9000 with MIT License | 6 votes |
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)
Example #4
Source File: led_strip.py From BerePi with BSD 2-Clause "Simplified" License | 5 votes |
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
Example #5
Source File: led_strip.py From BerePi with BSD 2-Clause "Simplified" License | 5 votes |
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
Example #6
Source File: bender_backlight.py From pRodriguezAssistant with GNU General Public License v3.0 | 5 votes |
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
Example #7
Source File: led_strip.py From BerePi with BSD 2-Clause "Simplified" License | 4 votes |
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