KRITSADA

Compass python microbit example

Oct 28th, 2019
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from microbit import *
  2.  
  3. if compass.is_calibrated() == False:
  4.     compass.calibrate()
  5.  
  6. while True:
  7.     needle = ((15 - compass.heading()) // 30) % 12      # 측정된 방위각을 12개로 나눈다.
  8.     display.show(Image.ALL_CLOCKS[needle])
Add Comment
Please, Sign In to add comment