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


Python SenseHat.show_letter方法代码示例

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


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

示例1: main

# 需要导入模块: from sense_hat import SenseHat [as 别名]
# 或者: from sense_hat.SenseHat import show_letter [as 别名]
def main():
    # Initialization stuff
    sense = SenseHat()
    sense.low_light = True
    # Display a random pixel matrix
    pixelValues = [ [ random.randint( 0, 255 ) for j in range( 3 ) ] for i in range( 64 ) ]
    sense.set_pixels( pixelValues )
    time.sleep( 3 )
    # Create a colour 'beat'
    for i in range( 3 ):
        sense.clear( 255, 0, 0 )
        time.sleep ( 0.333 )
        sense.clear( 0, 255, 0 )
        time.sleep ( 0.333 )
        sense.clear( 0, 0, 255 )
        time.sleep ( 0.333 )
    # Toy around with text display
    message = "Einfach Mensch..."
    sense.show_message( message, 0.05 )
    rotation = 0
    for letter in message:
        sense.set_rotation( rotation, False )
        rotation += 90
        if rotation == 270:
            rotation = 0
        sense.show_letter( letter )
        time.sleep( 0.24 )
    sense.clear()
开发者ID:markuspg,项目名称:SenseHatStuff,代码行数:30,代码来源:randomPixels.py

示例2: main

# 需要导入模块: from sense_hat import SenseHat [as 别名]
# 或者: from sense_hat.SenseHat import show_letter [as 别名]
def main():
	sense = SenseHat()
	"""
	sense.show_message("Hello World!!");
	sense.set_rotation(180)
	sense.show_message("Hello World!!");
	"""
	sense.flip_v()
	list = sense.get_pixels()
	#print list

	sense.set_pixel(0,0,255,0,0)
	sense.clear()
 	for i in range(0, 5):
		sense.show_letter(str(i))
		time.sleep(1)	
	sense.clear()	
开发者ID:MagorokuYohei,项目名称:hoby,代码行数:19,代码来源:led.py

示例3: SenseHat

# 需要导入模块: from sense_hat import SenseHat [as 别名]
# 或者: from sense_hat.SenseHat import show_letter [as 别名]
w = [150, 150, 150]
g = [0, 255, 0]
r = [255, 0, 0]
e = [0, 0, 0]
          
sad = [
e,e,e,e,e,e,e,e,
e,r,r,e,e,r,r,e,
e,r,r,e,e,r,r,e,
e,e,e,e,e,e,e,e,
e,e,e,e,e,e,e,e,
e,e,r,r,r,r,e,e,
e,r,e,e,e,e,r,e,
r,e,e,e,e,e,e,r
]

sense = SenseHat()

sense.show_message("Shutdown", scroll_speed=(0.05), text_colour=(255, 0, 0), back_colour=(0, 0, 0))

sense.show_letter("3")
sleep(1)
sense.show_letter("2")
sleep(1)
sense.show_letter("1")
sleep(1)
sense.set_pixels(sad)
sys.exit(0)

开发者ID:agsdot,项目名称:vagrant-archbox,代码行数:30,代码来源:sensehat-exit.py

示例4: SenseHat

# 需要导入模块: from sense_hat import SenseHat [as 别名]
# 或者: from sense_hat.SenseHat import show_letter [as 别名]
from time import sleep
from subprocess import check_output
from sense_hat import SenseHat

blue = [0,0,255]
green = [0, 255, 0]
red = [255,0,0]

color = green

sense = SenseHat()
output = check_output(['hostname', '-I'])
ipaddr = output.decode("utf-8").rstrip()

try:
    for i in range(10):
        sense.show_message(ipaddr, scroll_speed=0.03, text_colour=color)
        sense.show_letter(ipaddr[-1], text_colour=color)
        sleep(1)
finally:
    sense.clear()
开发者ID:stephandah,项目名称:RaspberryPiProjects,代码行数:23,代码来源:showIPAddr.py

示例5: print

# 需要导入模块: from sense_hat import SenseHat [as 别名]
# 或者: from sense_hat.SenseHat import show_letter [as 别名]
e,e,e,w,w,e,e,e
]

# Print it once
sh.set_pixels(arrow)

while True:
    x_full, y_full, z_full = sh.get_accelerometer_raw().values()

    x=round(x_full, 0)
    y=round(y_full, 0)
    z=round(z_full, 0)

    print ("x=%s, y=%s, z=%s" % (x_full,y_full,z_full))

    if x == -1:  # works
        sh.set_pixels(arrow)
        sh.set_rotation(180)
    elif x == 1: # works
        sh.set_pixels(arrow)
        sh.set_rotation(0)
        
    elif y == 1: 
        sh.set_pixels(arrow)
        sh.set_rotation(270)
    elif y == -1:
        sh.set_pixels(arrow)
        sh.set_rotation(90)
    else:
        sh.show_letter("*")
开发者ID:jrgifford,项目名称:sense-hat,代码行数:32,代码来源:rotating_letter.py

示例6: SenseHat

# 需要导入模块: from sense_hat import SenseHat [as 别名]
# 或者: from sense_hat.SenseHat import show_letter [as 别名]
from sense_hat import SenseHat
import time

# https://www.raspberrypi.org/learning/getting-started-with-the-sense-hat/worksheet/

sense = SenseHat()
sense.show_message("Hello World")

sense.show_letter("O", text_colour=[255, 0, 0])
time.sleep(1)

sense.show_letter("M", text_colour=[0, 0, 255])
time.sleep(1)

sense.show_letter("G", text_colour=[0, 255, 0])
time.sleep(1)

sense.show_letter("!", text_colour=[0, 0, 0], back_colour=[255, 255, 255])
time.sleep(1)
sense.clear()

t = sense.get_temperature()
p = sense.get_pressure()
h = sense.get_humidity()

t = round(t, 1)
p = round(p, 1)
h = round(h, 1)

msg = "Temperature = %s, Pressure=%s, Humidity=%s" % (t, p, h)
开发者ID:ylerjen,项目名称:pir-hat,代码行数:32,代码来源:hat-test.py

示例7: SenseHat

# 需要导入模块: from sense_hat import SenseHat [as 别名]
# 或者: from sense_hat.SenseHat import show_letter [as 别名]
from sense_hat import SenseHat
import time
import random 

sense = SenseHat()

sense.set_rotation(180)
r = random.randint (0, 255)
sense.show_letter("O",text_colour = [0, r, r])
time.sleep(2)

r = random.randint(0, 255)
sense.show_letter("M",text_colour = [r, r, 0])
time.sleep(2)

r = random.randint(0, 255)
sense.show_letter("G",text_colour = [r, r, 0])
time.sleep(2)

r = random.randint(0, 255)
sense.show_letter("!",text_colour = [0, r, r])
time.sleep(1)
sense.clear()
开发者ID:EliAntony,项目名称:code,代码行数:25,代码来源:random_omg.py

示例8: SenseHat

# 需要导入模块: from sense_hat import SenseHat [as 别名]
# 或者: from sense_hat.SenseHat import show_letter [as 别名]
from sense_hat import SenseHat
from time import sleep
from random import randint

sense = SenseHat()
sense.set_pixel(0,2,[0,0,255])
sense.set_pixel(7,4,[255,0,0])
sleep(1)
r = randint(0,255)
sense.show_letter("T", text_colour=[0,r,0])
sleep(2)
sense.show_message("Hello Dad, I'm tallulah", scroll_speed=0.12, text_colour=[0,251,0], back_colour=[0,0,0])

sense.clear()
开发者ID:ramesh-cit,项目名称:pi-python,代码行数:16,代码来源:hello.py

示例9: SenseHat

# 需要导入模块: from sense_hat import SenseHat [as 别名]
# 或者: from sense_hat.SenseHat import show_letter [as 别名]
from sense_hat import SenseHat
import time
import random

sense = SenseHat()

sense.show_message("Hallo", scroll_speed=0.05, text_colour=[255, 255, 0], back_colour=[0, 0, 255])
sense.show_letter("F", text_colour=[255, 0, 0])
time.sleep(1)
sense.show_letter("+", text_colour=[0, 255, 0])
time.sleep(1)
sense.show_letter("M", text_colour=[0, 0, 255])
time.sleep(1)


a = 0
while a < 3:
    a = a + 1
    z = random.randint(0, 255)
    y = random.randint(0, 255)
    x = random.randint(0, 255)
    sense.show_message("Bunt", scroll_speed=0.05, text_colour=[z, y, x])
sense.set_pixel(1, 1, [255, 0, 0])
sense.set_pixel(6, 6, [0, 0, 255])
time.sleep(1)


r = [255, 0, 0]
g = [0, 255, 0]
b = [0, 0, 255]
image = [
开发者ID:geomapping,项目名称:raspi-python,代码行数:33,代码来源:Getting-Started.py

示例10: SenseHat

# 需要导入模块: from sense_hat import SenseHat [as 别名]
# 或者: from sense_hat.SenseHat import show_letter [as 别名]
from sense_hat import SenseHat 
sense = SenseHat()  
# set up the colours (white, green, red, empty)  
green = [0,255,0]
orange = [255, 128, 0]
red = [255,0,0]
sense.show_letter("R",text_colour=orange)

开发者ID:anandbaskaran,项目名称:ParkingLot,代码行数:9,代码来源:ledDisplayOrange.py

示例11: SenseHat

# 需要导入模块: from sense_hat import SenseHat [as 别名]
# 或者: from sense_hat.SenseHat import show_letter [as 别名]
from sense_hat import SenseHat
sense = SenseHat()
import time

sense.show_letter("J")

while True:
  x, y, z = sense.get_accelerometer_raw().values()

  x = round(x, 0)
  y = round(y, 0)

  if x == -1:
      sense.set_rotation(180)
  elif y == -1:
      sense.set_rotation(90)
  elif y == 1:
      sense.set_rotation(270)
  else:
      sense.set_rotation(0)

  time.sleep(0.1)
开发者ID:juvchan,项目名称:getting-started-with-the-sense-hat,代码行数:24,代码来源:rotating_letter.py

示例12: SenseHat

# 需要导入模块: from sense_hat import SenseHat [as 别名]
# 或者: from sense_hat.SenseHat import show_letter [as 别名]
from sense_hat import SenseHat
import time

sense = SenseHat()
sense.clear()
dt = 0.05
x,y,z = sense.get_accelerometer_raw().values()
while (x**2+y**2+z**2 < 8):
	sense.show_letter("|")
	time.sleep(dt)
        sense.show_letter("/")
	time.sleep(dt)
        sense.show_letter("-")
	x,y,z = sense.get_accelerometer_raw().values()
	time.sleep(dt)
        sense.show_letter("\\")
	time.sleep(dt)
sense.clear()
开发者ID:kel85uk,项目名称:RaspberryPi_Projects,代码行数:20,代码来源:chopper.py

示例13: SenseHat

# 需要导入模块: from sense_hat import SenseHat [as 别名]
# 或者: from sense_hat.SenseHat import show_letter [as 别名]
import time
from sense_hat import SenseHat
sh = SenseHat()
for i in reversed(range(0,10)):
	sh.show_letter(str(i))
	time.sleep(1)

开发者ID:smstext,项目名称:SenseHat,代码行数:8,代码来源:countdown.py

示例14: SenseHat

# 需要导入模块: from sense_hat import SenseHat [as 别名]
# 或者: from sense_hat.SenseHat import show_letter [as 别名]
from sense_hat import SenseHat
import time

sense = SenseHat()

sense.show_letter(">")

angles = [0, 90, 180, 270, 0, 90, 180, 270]
for r in angles:
    sense.set_rotation(r)
    time.sleep(0.5)
开发者ID:brookshire,项目名称:pypicamcapper,代码行数:13,代码来源:5_spinning.py

示例15:

# 需要导入模块: from sense_hat import SenseHat [as 别名]
# 或者: from sense_hat.SenseHat import show_letter [as 别名]
		elif y == 1:
			sense.set_rotation(270)
		elif y == -1:
			sense.set_rotation(90)
		else:
			sense.set_rotation(0)

	if currentMode == 3:
		if lastRun is not currentMode:
			# first execution stuff here if needed
			sense.set_rotation(0)
			lastRun = currentMode
		sense.show_message("Raspberry Pi Loves Maker Faire", scroll_speed=.04, text_colour=(255,0,0))
		currentMode = 0
	if currentMode == 4:
		if lastRun is not currentMode:
			sense.show_message("ASK ME ANYTHING AND SHAKE!", scroll_speed=.03, text_colour=(255,0,0))
			lastRun = currentMode
			sense.show_letter("?", text_colour=(255,0,0))
		while currentMode == 4:
			x, y, z = sense.get_accelerometer_raw().values()
			if x > 2.5 or x < -2.5 or y > 2.5 or y < -2.5 or z > 2.5 or z < -2.5:
				sense.show_message(random.choice(replies), scroll_speed=.03, text_colour=(255,0,0))
				sense.show_letter("?", text_colour=(255,0,0))
			sleep(0.1)
			




开发者ID:monkeymademe,项目名称:maker-faire-sense-hat-demo,代码行数:27,代码来源:maker-faire.py


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