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


Python AstroPi.show_letter方法代码示例

本文整理汇总了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)
开发者ID:LornaLynch,项目名称:getting-started-with-astro-pi,代码行数:24,代码来源:rotating_letter.py

示例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
开发者ID:LornaLynch,项目名称:getting-started-with-astro-pi,代码行数:18,代码来源:shake.py

示例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()
开发者ID:LornaLynch,项目名称:getting-started-with-astro-pi,代码行数:23,代码来源:random_omg.py

示例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



开发者ID:topshed,项目名称:HTLogger,代码行数:29,代码来源:HTLogger.py


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