+21622886281
Joystick Micro:bit

Order the Micro:bit board by joystick

Purpose of this tutorial:

In this tutorial we will see how to display an arrow on micro:bit whose orientation depends on the direction of the joystick controller:

  • When the user directs the joystick controller to the right, the arrow ” →” is displayed on the micro:bit card.
  • When the user points the joystick to the left, the arrow “←” is displayed on the micro:bit card.
  • When the user points the joystick joystick forward, the arrow “↑” is displayed on the micro:bit card.
  • When the user moves the joystick backwards, the arrow “↓” is displayed on the micro:bit card.
  • When the user presses the joystick button, the value 1 is displayed on the micro:bit card.

Composants nécessaires

  • carte micro:bit
  • manette joystick
  • des fils de connexion
  • micro:bit GPIO Expansion Board
  • plaque d’essai (Pour le montage 1)

Mounting:

To perform the assembly we connect:

  • The +5V to 3.3V pin of the micro:bit
  • The GND pin to the GND from the micro:bit
  • VRx to the pin P2 from the micro:bit
  • VRy to the pin P1 from the micro:bit
  • SW to the pin P0 from the micro:bit

There are several mounting methods.

Mounting (1)

Mounting (2)

Makecode program

  • When the user points the joystick joystick forward, Pin P2 of the micro:bit connected to the VRx of the joystick returns the value 3.
  • When the user points the joystick joystick back, Pin P2 of the micro:bit connected to the VRx of the joystick returns the value 1023.
  • When the user points the joystick joystick to the right, Pin P1 of the micro:bit connected to the VRy of the joystick returns the value 3.
  • When the user points the joystick joystick to the left, Pin P1 of the microphone:bit connected to the VRy of the joystick returns the value 1023.
  • When the user presses the joystick joystick, Pin P0 of the micro:bit connected to the joystick SW returns the value 0.



0 commentaire


Leave a comment

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Scroll to Top