Using A Rotary Encoder On The Microbit
Using A Rotary Encoder On The Microbit
Turning Clockwise
Turning Anti-Clockwise
Enter Data Using a Rotary Knob Device (Rotary Encoder)
Create Wait Here until
All This the First Edge of
Pulse A occurs.
Code
Initialise the
Micro:bit’s
Pins used and
the variable
Counter.
Observe:
• The display only Counts Up or Down Cor-
rectly if the Knob is Rotated Very Slowly.
Reason:
• The Show Number takes a Long Time to
execute, so the Micro:bit may Miss Some
Wait until Pulse A
of the Pulses.
has completed.
Solution:
• Use the Serial Write Number as opposed
to Show Number to display the numbers i.e. Wait for it to
on the PC ‘s Screen instead. go Low Again