コード例 #1
0
ファイル: pixelart.py プロジェクト: MrChrisPenn/HpAnthologyV2
from sense_emu import SenseHat
import time
import random

s = SenseHat()
s.low_light = False

green = (0, 255, 0)
yellow = (255, 255, 0)
blue = (0, 0, 255)
red = (255, 0, 0)
white = (255, 255, 255)
nothing = (0, 0, 0)
pink = (255, 105, 180)

ColourList = [green, yellow, blue, red, white, pink]


def raspi_logo():
    G = green
    R = red
    O = nothing
    logo = [
        O,
        G,
        G,
        O,
        O,
        G,
        G,
        O,
コード例 #2
0
from sense_emu import SenseHat
import time

s = SenseHat()
s.low_light = True

green = (0, 255, 0)


def any(event):
    global count
    if event.action == "pressed":
        s.show_letter(str(initials[count % len(initials)]), green)
        count += 1


initials = ["A", "T"]
count = 0

s.stick.direction_right = any

while True:
    time.sleep(0.75)
コード例 #3
0
from sense_emu import SenseHat
from time import sleep
from random import shuffle
from random import *

random_list = [0, 0, 0, 0, 0, 0, 0, 0]  #Set up the array
sorted = False
pointer = 0
passes = (len(random_list) - 1)
temp = 0
swap_made = True
my_pass = 0

sense = SenseHat()
sense.low_light = True  # This makes it easier to film the results
sense.clear()
colour = (0, 0, 0)
sense.set_pixel(0, 1, colour)


def populate_list():
    count = 0
    while count <= 7:  # This number can change if you are not using the SenseHat
        random_list[count] = randint(
            0, 10)  # This method will probaby generate repeated
        count += 1
    shuffle(random_list)
    shuffle(random_list)
    shuffle(random_list)
    check_pixel()
コード例 #4
0
from sense_emu import SenseHat
from time import sleep

sense = SenseHat()
sense.low_light = True

#load the Raspimons you want to animate
r = (255, 0, 0
     )  # RED color, stored in an another data structure called a tuple.
k = (0, 0, 0)  # black means zero amounts of red, green and blue
r = (255, 0, 0)
g = (0, 255, 0)
b = (0, 0, 255)
k = (0, 0, 0)
w = (255, 255, 255)
c = (0, 255, 255)
y = (255, 255, 0)
o = (255, 128, 0)
n = (255, 128, 128)
p = (128, 0, 128)
d = (255, 0, 128)
l = (128, 255, 128)

rmon1 = [
    c, c, c, c, c, c, c, c, c, c, n, n, n, n, c, c, c, n, n, n, n, n, n, c, c,
    n, n, k, n, k, n, c, n, n, n, b, n, b, n, n, n, n, d, n, n, n, d, n, c, n,
    n, n, n, n, n, c, g, n, n, g, g, n, n, g
]

rmon2 = [
    c, c, n, n, n, n, c, c, c, n, n, n, n, n, n, c, c, n, n, k, n, k, n, c, n,
コード例 #5
0
sense = SenseHat()

# Define the colours red and green
red = (255, 0, 0)
green = (0, 255, 0)
blue = (0, 0, 255)
yellow = (255, 255, 0)
white = (255, 255, 255)
nothing = (0, 0, 0)
pink = (255, 105, 180)

ColourList = [green, yellow, blue, red, white, pink]

sense.clear()
sense.low_light = False


def raspi_logo():
    G = green
    R = red
    O = nothing
    logo = [
        O,
        G,
        G,
        O,
        O,
        G,
        G,
        O,