本文整理汇总了Python中astro_pi.AstroPi.show_letter方法的典型用法代码示例。如果您正苦于以下问题:Python AstroPi.show_letter方法的具体用法?Python AstroPi.show_letter怎么用?Python AstroPi.show_letter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类astro_pi.AstroPi
的用法示例。
在下文中一共展示了AstroPi.show_letter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AstroPi
# 需要导入模块: from astro_pi import AstroPi [as 别名]
# 或者: from astro_pi.AstroPi import show_letter [as 别名]
from astro_pi import AstroPi
ap = AstroPi()
import time
ap.show_letter("J")
while True:
x,y,z = ap.get_accelerometer_raw().values()
x=round(x,0)
y=round(y,0)
if x == -1:
ap.set_rotation(180)
elif y == 1:
ap.set_rotation(90)
elif y == -1:
ap.set_rotation(270)
else:
ap.set_rotation(0)
time.sleep(0.1)
示例2: AstroPi
# 需要导入模块: from astro_pi import AstroPi [as 别名]
# 或者: from astro_pi.AstroPi import show_letter [as 别名]
from astro_pi import AstroPi
ap = AstroPi()
import time
while True:
x,y,z = ap.get_accelerometer_raw().values()
x=abs(x)
y=abs(y)
z=abs(z)
if x > 1 or y > 1 or z>1:
ap.show_letter("!",text_colour=[255,0,0])
else:
ap.clear()
time.sleep(0.1
示例3: AstroPi
# 需要导入模块: from astro_pi import AstroPi [as 别名]
# 或者: from astro_pi.AstroPi import show_letter [as 别名]
from astro_pi import AstroPi
import time
import random
ap = AstroPi()
r = random.randint(0,255)
ap.show_letter("O",text_colour=[r,0,0])
time.sleep(1)
r = random.randint(0,255)
ap.show_letter("M",text_colour=[0,0,r])
time.sleep(1)
r = random.randint(0,255)
ap.show_letter("G",text_colour=[0,r,0])
time.sleep(1)
ap.show_letter("!",text_colour=[0,0,0],back_colour=[255,255,255])
time.sleep(1)
ap.clear()
示例4:
# 需要导入模块: from astro_pi import AstroPi [as 别名]
# 或者: from astro_pi.AstroPi import show_letter [as 别名]
r = [0,255,0] # green if higher
elif hum_int == hum_prev:
r = [0,0,255] # blue if the same
else:
r = [0,255,255] # light blue if lower
hum_prev = hum_int
image=TDG.numToMatrix(hum_int,back_colour=[0,0,0],text_colour=r)
ap.set_pixels(image)
elif y == -1 and x != -1: # temp display if USB ports pointing upwards
ap.set_rotation(180)
if temp_int > temp_prev: # Is the latest reading higher than the last?
r = [255,0,0] # red if higher
elif temp_int == temp_prev:
r = [255,128,0] # orange if the same
else:
r = [255,215,0] # yellow if lower
temp_prev = temp_int
# use numToMatrix to turn the number into a 64 item list suitable for the LED
image=TDG.numToMatrix(temp_int,back_colour=[0,0,0],text_colour=r)
ap.set_pixels(image)
elif x == 0 and y == 0: # if the Pi is flat on its back
ap.show_message("Recording", text_colour=[150,150,150],scroll_speed=0.03)
else:
ap.show_letter("?") # display a ? if at some other orientation
time.sleep(dataDisplayInterval)
sec_count+=1