Exemple #1
0
#CLOCK_OUTLINE		= SerialTFT.Color.user_magenta
#CLOCK_CENTER		= SerialTFT.Color.user_blue
#CLOCK_NUMBERS		= SerialTFT.Color.user_green
#CLOCK_DIGITAL		= SerialTFT.Color.user_blue
#CLOCK_HOUR_HAND	= SerialTFT.Color.user_cyan
#CLOCK_MINUTE_HAND 	= SerialTFT.Color.user_cyan
#CLOCK_SECOND_HAND 	= SerialTFT.Color.user_red
# -- END COLOR SETUP --

# Clear Screen
tft.screen_rotation(SerialTFT.Rotation.landscape)
tft.bg_color(CLOCK_BACKGROUND)
tft.clear_screen()

# Draw the numbers 12, 6, 3 and 9 around the clock in green
tft.font_size(SerialTFT.Font.small)
tft.fg_color(CLOCK_NUMBERS)

tft.goto_pixel(SerialTFT.Screen.width_half-5,5)
tft.write('12')

tft.goto_pixel(SerialTFT.Screen.width_half-3,SerialTFT.Screen.height-13)
tft.write('6')

tft.goto_pixel(SerialTFT.Screen.width_half+50,SerialTFT.Screen.height_half-3)
tft.write('3')

tft.goto_pixel(SerialTFT.Screen.width_half-54,SerialTFT.Screen.height_half-3)
tft.write('9')

# Draw clock outline
Exemple #2
0
# Clear Screen
tft.screen_rotation(SerialTFT.Rotation.landscape)
tft.bg_color(SerialTFT.Color.black)
tft.clear_screen()

colors = [
	SerialTFT.Color.blue,
	SerialTFT.Color.red,
	SerialTFT.Color.green,
	SerialTFT.Color.cyan,
	SerialTFT.Color.magenta,
	SerialTFT.Color.yellow,
	SerialTFT.Color.white
]

tft.font_size(SerialTFT.Font.small)
tft.fg_color(SerialTFT.Color.white)
print('Drawing text')
tft.write_line('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent eu turpis enim, at luctus quam. Mauris augue augue, blandit quis dictum in, accumsan eget odio. In id laoreet massa.')
tft.font_size(SerialTFT.Font.medium)
tft.write_line('Starting load tests')
tft.font_size(SerialTFT.Font.large)
tft.write_line('Soooon')
time.sleep(5)

print('Testing pixel draw rate')
result = []
circle_count = 0
last_sec = time.localtime().tm_sec
total_count = 0
while len(result) < 10: