本文整理匯總了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