Tài Liệu Học Tập
No Result
View All Result
  • Đề Thi
  • Lớp 12
    • Lịch Sử Lớp 12
    • Địa Lí Lớp 12
    • Ngữ Văn Lớp 12
    • GD KTPL Lớp 12
    • Toán Lớp 12
    • Tiếng Anh Lớp 12
    • Hóa Học Lớp 12
    • Sinh Học Lớp 12
    • Vật Lí Lớp 12
  • Lớp 11
    • Toán Lớp 11
    • Ngữ Văn Lớp 11
    • Tiếng Anh Lớp 11
    • Hóa Học Lớp 11
    • Sinh Học Lớp 11
    • Vật Lí Lớp 11
    • Lịch Sử Lớp 11
    • Địa Lí Lớp 11
    • GDCD Lớp 11
  • Lớp 10
    • Toán Lớp 10
    • Ngữ Văn Lớp 10
    • Tiếng Anh Lớp 10
    • Hóa Học Lớp 10
    • Sinh Học Lớp 10
    • Vật Lí Lớp 10
    • Lịch Sử Lớp 10
    • Địa Lí Lớp 10
    • GDKTPL Lớp 10
    • Công nghệ lớp 10
    • Tin Học Lớp 10
  • Lớp 9
    • Toán Lớp 9
    • Ngữ Văn Lớp 9
    • Tiếng Anh Lớp 9
    • Lịch sử và địa lý lớp 9
    • Khoa Học Tự Nhiên Lớp 9
    • GDCD Lớp 9
  • Lớp 8
    • Toán Lớp 8
    • Ngữ Văn Lớp 8
    • Tiếng Anh Lớp 8
    • Lịch sử và địa lý lớp 8
    • Khoa Học Tự Nhiên Lớp 8
    • GDCD 8
  • Lớp 7
    • Toán Lớp 7
    • Văn Lớp 7
    • Tiếng Anh Lớp 7
    • Lịch Sử Và Địa Lí Lớp 7
    • Khoa Học Tự Nhiên Lớp 7
  • Lớp 6
    • Toán Lớp 6
    • Văn Lớp 6
    • Tiếng Anh lớp 6
    • Lịch Sử và Địa Lí Lớp 6
    • Khoa Học Tự Nhiên lớp 6
  • Lớp 5
    • Toán lớp 5
    • Tiếng Việt Lớp 5
    • Tiếng Anh Lớp 5
    • Lịch Sử và Địa Lí Lớp 5
  • Lớp 4
    • Toán lớp 4
    • Tiếng Việt Lớp 4
    • Tiếng Anh Lớp 4
    • Lịch Sử và Địa Lí Lớp 4
  • Lớp 3
    • Toán lớp 3
    • Tiếng Anh Lớp 3
    • Tiếng Việt Lớp 3
  • Mẹo Hay
  • Tin tức
  • Liên Hệ
Tài Liệu Học Tập
No Result
View All Result
Home Tin tức

Pimoroni Explorer Kit Tutorial

by Tranducdoan
15/12/2025
in Tin tức
0
Đánh giá bài viết

The following code demonstrates the use of the Pimoroni Explorer Kit as a desktop auto clock/calendar/weather station. I hope someone finds it useful.

Triangles used to be difficult but the latest version of picographics makes them easy to use. I really like the larger screen. It shows off the 320×240 pixels much better. The multi-sensor-stick is really easy to use.

# Pimoroni Explorer Demo # Analog/ Digital clock – Tony Goodhew, Leicester UK – 6 Nov 2024 # Uses the Multi-Sensor Stick (BME280 + LTR559 + LSM6DS3) from explorer import display, i2c, button_z, button_x, button_y, BLACK, WHITE, GREEN, RED, BLUE, YELLOW, CYAN from breakout_bme280 import BreakoutBME280 from breakout_ltr559 import BreakoutLTR559 import math import time # Check sensor stick connected try: bme = BreakoutBME280(i2c, address=0x76) ltr = BreakoutLTR559(i2c) except RuntimeError: display.set_layer(0) display.set_pen(RED) display.clear() display.set_pen(WHITE) display.text(“Multi-Sensor Stick missing”, 10, 95, 320, 3) display.update() WIDTH, HEIGHT = display.get_bounds() # Get current time year, month, day, h, m, s, wd, _ = time.localtime() days = [“Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”, “Sunday”] months = [“Jan”, “Feb”, “Mar”, “Apr”, “May”, “Jun”, “Jul”, “Aug”, “Sep”, “Oct”, “Nov”, “Dec”] # Used for minute and hour hands def hand(ang, long): ang = ang-90 ls = long/10 x0 = int(round(long * math.cos(math.radians(ang))))+cx y0 = int(round(long * math.sin(math.radians(ang))))+cy x1 = int(round(ls * math.cos(math.radians(ang+90))))+cx y1 = int(round(ls * math.sin(math.radians(ang+90))))+cy x2 = int(round(ls * math.cos(math.radians(ang-90))))+cx y2 = int(round(ls * math.sin(math.radians(ang-90))))+cy display.triangle(x0,y0,x1,y1,x2,y2) display.circle(cx,cy,int(ls)) display.set_backlight(1.0) display.set_layer(0) display.set_pen(BLACK) display.clear() display.set_layer(1) display.set_pen(BLACK) display.clear() cx = 199 # centre of clock cy = 119 l = 110 # Draw clock face display.set_pen(BLUE) display.circle(cx,cy,110) display.update() ls = 94 display.set_pen(WHITE) for angle in range(0,360,6): xx = int(round(l * math.cos(math.radians(angle)))) yy = int(round(l * math.sin(math.radians(angle)))) display.line(cx,cy,cx+xx,cy+yy) display.set_pen(BLACK) display.circle(cx,cy,100) display.set_pen(WHITE) for angle in range(0,360,30): xx = int(round(l * math.cos(math.radians(angle)))) yy = int(round(l * math.sin(math.radians(angle)))) display.line(cx,cy,cx+xx,cy+yy) # Sensor titles display.set_pen(WHITE) display.text(“Temperature”,5,40,310,1) display.text(“Lux”,5,80,300,1) display.text(“Rel Humidity”,5,120,300,1) display.text(“Air Pressure”,5,200,300,1) # === Main Loop ====== while True: # Draw face numbers display.set_pen(BLACK) display.circle(cx,cy,93) # Clear centre of clock face display.set_pen(YELLOW) display.text(“9”,118,108,320,3) display.text(“3”,268,108,320,3) display.text(“10”,128,70,320,3) display.text(“2”,258,70,320,3) display.text(“1”,230,45,320,3) display.text(“11”,160,45,320,3) display.text(“12”,190,37,320,3) display.text(“6”,193,186,320,3) display.text(“7”,156,176,320,3) display.text(“5”,230,176,320,3) display.text(“4”,258,150,320,3) display.text(“8”,130,150,320,3) # Draw hands mang = int((m + s/60)* 6) # angle of minute hand hang = int((h + m/60 )* 30 ) # angle of hour hand display.set_pen(BLUE) hand(mang,90) display.set_pen(RED) hand(hang,70) sang = 6 * s – 90 xs = int(round(ls * math.cos(math.radians(sang)))) ys = int(round(ls * math.sin(math.radians(sang)))) display.set_pen(WHITE) display.line(cx,cy,cx+xs,cy+ys) display.circle(cx,cy,3) # Assemble Digital time ss = “0” + str(s) lgs =len(ss) ss = ss[lgs-2:lgs] ms = “0” + str(m) lgs = len(ms) ms = ms[lgs-2:lgs] hs = “0” + str(h) lgs = len(hs) hs = hs[lgs-2:lgs] dt = hs+”:”+ms+”:”+ss # Clear sensor text areas display.set_pen(BLACK) display.rectangle(5,10,127,18) display.rectangle(5,50,90,18) display.rectangle(5,90,80,18) display.rectangle(5,130,80,18) display.rectangle(5,210,115,18) display.rectangle(5,163,90,28) # Write digital time & sensor readings display.set_pen(YELLOW) display.text(dt,5,10,320,3) # read the sensors temperature, pressure, humidity = bme.read() temp = round(temperature,1) display.set_pen(GREEN) display.text(str(temp)+” C”,5,50,320,3) # Convert pressure to hPa pressurehpa = int(pressure / 100) display.text(str(int(humidity)) +” %”, 5,130,320,3) display.text(str(pressurehpa)+” hPa”,5,210,320,3) prox, a, b, c, d, e, lux = ltr.get_reading() lux = int(lux) display.set_pen(CYAN) display.text(str(lux),5,90,320,3) # Update date/time year, month, day, h, m, s, wd, _ = time.localtime() display.text(days[wd],5,163,320,1) display.text(str(day)+” “+months[month-1],5,173,320,2) display.update() time.sleep(0.1)

Video here: https://youtu.be/p8yvwJqr3u4

If you would like a tutorial on using the tilt aspects of the IMU, please leave a comment.

Previous Post

Cách tính điểm thi lớp 10 THPT công lập và trường chuyên tại Hà Nội

Next Post

Ca(HCO3)2 + NaOH → CaCO3 ↓ + H2O + NaHCO3

Tranducdoan

Tranducdoan

Trần Đức Đoàn sinh năm 1999, anh chàng đẹp trai đến từ Thái Bình. Hiện đang theo học và làm việc tại trường cao đẳng FPT Polytechnic

Next Post

Ca(HCO3)2 + NaOH → CaCO3 ↓ + H2O + NaHCO3

Xoilac TV trực tiếp bóng đá đọc sách online Socolive trực tiếp Ca Khia TV trực tiếp XoilacTV sàn forex uy tín 789bet sumclub game bài đổi thưởng topclub 789p 388bet 69vn FUN79 KP88 555win 888now 888top สล็อต999 https://p789bet.biz/ cakhia VN88
Tài Liệu Học Tập

Copyright © 2022 Tài Liệu Học Tập.

Chuyên Mục

  • Đề Thi
  • Lớp 12
  • Lớp 11
  • Lớp 10
  • Lớp 9
  • Lớp 8
  • Lớp 7
  • Lớp 6
  • Lớp 5
  • Lớp 4
  • Lớp 3
  • Mẹo Hay
  • Tin tức
  • Liên Hệ

Tham Gia Group Tài Liệu Học Tập

No Result
View All Result
  • Đề Thi
  • Lớp 12
    • Lịch Sử Lớp 12
    • Địa Lí Lớp 12
    • Ngữ Văn Lớp 12
    • GD KTPL Lớp 12
    • Toán Lớp 12
    • Tiếng Anh Lớp 12
    • Hóa Học Lớp 12
    • Sinh Học Lớp 12
    • Vật Lí Lớp 12
  • Lớp 11
    • Toán Lớp 11
    • Ngữ Văn Lớp 11
    • Tiếng Anh Lớp 11
    • Hóa Học Lớp 11
    • Sinh Học Lớp 11
    • Vật Lí Lớp 11
    • Lịch Sử Lớp 11
    • Địa Lí Lớp 11
    • GDCD Lớp 11
  • Lớp 10
    • Toán Lớp 10
    • Ngữ Văn Lớp 10
    • Tiếng Anh Lớp 10
    • Hóa Học Lớp 10
    • Sinh Học Lớp 10
    • Vật Lí Lớp 10
    • Lịch Sử Lớp 10
    • Địa Lí Lớp 10
    • GDKTPL Lớp 10
    • Công nghệ lớp 10
    • Tin Học Lớp 10
  • Lớp 9
    • Toán Lớp 9
    • Ngữ Văn Lớp 9
    • Tiếng Anh Lớp 9
    • Lịch sử và địa lý lớp 9
    • Khoa Học Tự Nhiên Lớp 9
    • GDCD Lớp 9
  • Lớp 8
    • Toán Lớp 8
    • Ngữ Văn Lớp 8
    • Tiếng Anh Lớp 8
    • Lịch sử và địa lý lớp 8
    • Khoa Học Tự Nhiên Lớp 8
    • GDCD 8
  • Lớp 7
    • Toán Lớp 7
    • Văn Lớp 7
    • Tiếng Anh Lớp 7
    • Lịch Sử Và Địa Lí Lớp 7
    • Khoa Học Tự Nhiên Lớp 7
  • Lớp 6
    • Toán Lớp 6
    • Văn Lớp 6
    • Tiếng Anh lớp 6
    • Lịch Sử và Địa Lí Lớp 6
    • Khoa Học Tự Nhiên lớp 6
  • Lớp 5
    • Toán lớp 5
    • Tiếng Việt Lớp 5
    • Tiếng Anh Lớp 5
    • Lịch Sử và Địa Lí Lớp 5
  • Lớp 4
    • Toán lớp 4
    • Tiếng Việt Lớp 4
    • Tiếng Anh Lớp 4
    • Lịch Sử và Địa Lí Lớp 4
  • Lớp 3
    • Toán lớp 3
    • Tiếng Anh Lớp 3
    • Tiếng Việt Lớp 3
  • Mẹo Hay
  • Tin tức
  • Liên Hệ

Copyright © 2022 Tài Liệu Học Tập.