Welcome to the DFRobot blog
:
www.dfrobot.com/blog-tag-microbit.html
66
/
86
vice versa. Since the output value of the accelerometer ranges between -2048 and 2048, and in
our case, the maximum value it will reach is -500 and 500. we can make the -500 ~ 500 correspond
to 0 ~ 180 degrees of the servo through the function
“
map
”
.
STEP 2: Fix the servo and expansion board with tape so that these two remain relatively still. Note
that the orientation of the servo needs to be the same as that of the USB port so that the gear shaft
is perpendicular to the X axis and the degree of rotating of the servo is complementary to the
degree of tilting of micro: bit.
Exercises
Try building a compass using the electronic compass built into micro: bit.