So far, you have used all of the Hummingbird sensors. The micro:bit also contains sensors, which you will learn to use in this lesson and the next. This lesson will cover how to use the buttons on the micro:bit and the micro:bit accelerometer.
The micro:bit has two buttons labeled ‘A’ and ‘B.’ Use the getButton() method to find out whether a button is being pressed. The getButton() method takes one parameter, a string equal to ‘A’ or ‘B’ that tells the program which button you are interested in. The method returns a Boolean value. It returns True when the button is being pressed and False otherwise.