Microbit Gamepad Expansion Board

Important updates: Micro:bit and this motor-driven expansion board have officially supported scratch! Based on mind+ developed by scratch3.0, dfrobot integrates the graphical programming of micro:bit and its peripheral products, offline graphical programming, and supports Arduino and Python code generation.

GamePad for micro:bit V3.0

Introduction

Gamepad for microbit V3.0 adopts micro:bit control handle with rocker design and high-precision three-axis analog rocker. With the addition of analog rocker, you can control Maqueen's direction and speed at the same time. Moreover, with up to 7 programmable keys, you can also control more interesting functions, or switch to a more simple and understandable switching value control mode. In the latest products, we put the battery box directly on the PCB board, which is more convenient and easy to use in use and teaching experience.

Product function indication diagram

Specifications

Shipping List

[DFR0536]GamePad for microbit x1

Programming on MakeCode

The basic usage of MakeCode will be omitted here. This chapter will mainly introduce the function of product and how to program it on MakeCode.

MakeCode address and program library

MakeCode programming platform address: https://makecode.microbit.org
GamePad library: you can directly program this product on MakeCode without any third-party libraries.

Dice fight

Introduction

This routine uses two micro: bit wireless communication to simulate the game of rolling dice. When running this routine, download the program to two micro: bit motherboards and plug the motherboard into the gamepad.

Program for Maqueen Lite: https://makecode.microbit.org/_YdWVgV7j7LhA

Microbit Gamepad Expansion Board

Result:

  1. When starting up, set the wireless to group 1 and initialize the value of the variable item to 0;
  2. When vibration is detected, turn off the LED and initialize value to 0; The value of acceleration is used to generate a random number between 1 and 6;
  3. It is displayed incrementally from 1 to the number randomly generated on the LED dot matrix; And play the tone;
  4. Send random numbers from 1 to 6 to another motherboard wirelessly;
  5. Compare the received number with the random number generated by yourself. If the number is greater than the other party, the vibration motor will vibrate, otherwise it will not vibrate;

Control Maqueen Lite via Switch Quantity

Introduction

Use the Gamepad’s joystick to operate Maqueen to move forward and backward, turn left and right. Press the up and down buttons to control the movement of the gripper, the left and right buttons to turn the robot car’s LEDs on/off. Install the gripper on Maqueen Lite and connect it to port S1.

Microbit Gamepad Expansion Board

Program for Maqueen Lite: https://makecode.microbit.org/_Vot7AfUW7g6D

Microbit Gamepad Expansion Board

Program for GamePad: https://makecode.microbit.org/_PtgDRughPidF

Microbit Gamepad Expansion Board

Operation Effect

Run the program, toggle the rocker, and Maqueen Lite executes as follows:

Microbit Gamepad Expansion Board

Control Maqueen Lite via Analog Quantity

Introduction

We have learned how to control the direction of the robot car in the last example. Now we will use analog quantity of the joystick to control the direction and speed of the robot simultaneously. Press the up an down buttons to control the movement of the loader, the left and right buttons to turn the robot car’s LEDs on/off.

Microbit Gamepad Expansion Board

Program for Maqueen:https://makecode.microbit.org/_3WRLraYKPM2y

Microbit Gamepad Expansion Board

Program for GamePad:https://makecode.microbit.org/_1WYL7aKctdav

Microbit Gamepad Expansion Board

Operation Effect

Run the program, toggle the rocker, and Maqueen Lite executes as follows:

Microbit Gamepad Expansion Board

Note: the greater the amplitude of the rocker, the faster the trolley will run.

GamePad for micro:bit V2.0

Microbit Gamepad Expansion Board

Introduction

Micro:bit gamepad is an expansion gamepad based on micro:bit. You only need to plug in the micro:bit, it will turn into a wireless remote controller or a wireless game console. This product packaged with acrylic plate, that giving it a good feel and no longer feels like a bare circuit board. The gamepad has a total of 8 buttons, the left side have up, down, left, right four buttons, the right side has X, Y two buttons, and two buttons A, B are in the front of the gamepad. The gamepad also has programmable built-in vibration motor, buzzer, and LED. Using graphical programming, it will turn into a multimedia vibration controller or multimedia interactive game console instantly. The programming platform supports MakeCode graphical programming and python. It is a very suitable tool for both beginners and masters.

Specification

Board Overview

Function Description
LED Control pin P16
Vibration Motor Control pin P12
Buzzer Control pin P0
PWR Power Indicator
Switch Turn off the power
Opearting Voltage 3V~3.7V(2x AAA batteries)

Tutorial

MakeCode Graphical Programming

The basic tutorial of MakeCode:

  1. Enter MakeCode
  2. Find Advanced > Add package
  3. Copy the library link and paste it in the option box
  4. Click the gamepad, and you can find a new icon on the right.

The programming of event trigger

Result: When the X is pressed, the vibration motor vibrates and the LED lights up; when the X is released, the vibration motor stops and the LED turns off.

Result: When the X is pressed, the vibrating motor vibrates and the LED lights up; when the Y is pressed, the vibrating motor stops and the LED turns off.

The Programming of Cyclic Query

Result: When the X is pressed, the vibration motor vibrates at the strength of 175, and when the X is released, the vibration motor stops vibrating.

Rock-Paper-Scissors

Graphical source program: Rock-Paper-Scissors

Execution of the Program:

  1. First, you should set the two main boards are in the 1th wireless group, so that they can communicate with each other.
  2. When the left button is pressed, LED dot matrix displays the scissors, and sends the number 1.
  3. When the down button is pressed, LED dot matrix displays the rock, and sends the number 2.
  4. When the right button is pressed, LED dot matrix displays the paper, and sends the number 3.
  5. In the infinite loop, compare the wireless received numbers with your own Numbers;if you lost,it will display “×", if you win, it will show "√".
  6. After showing the result, clear all data.

Yacht

Graphical source program: Dice Game

Execution of the Program:

  1. Set the wireless to group 1 when booting, and initialize item to 0.
  2. When the vibration is detected, turn off the LED and initialize the value to 0, and use the acceleration value to produce a random number between 1 and 6.
  3. Incremental display from 0 to randomly generated number on the LED dot matrix, play the pitch and vibrate motor.
  4. Send 1~6 random numbers to other main boards via wireless.
  5. Comparing the random number with the received number. If it is less than the received number, turn off the light, otherwise turn on the light.

Remote Control Handle

Graphical source program of handle: Gamepad Graphical source program of car: Mobile Platform

Execution of the Program:

  1. Set the wireless to group 1.
  2. When different buttons are pressed, send different numbers to let the car performs different actions.
  3. When the button is released, the number 0 is sent to make the car stop.

Execution of the Program:

  1. Set the wireless to group 1.
  2. When receiving different numbers, let the car perform different actions such as forward, backward, turn left, turn right.

FAQ

Q&A Some general Arduino Problems/FAQ/Tips
A For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents

DFshopping_car1.png Get micro:Gamepad from DFRobot Store or DFRobot Distributor.

Turn to the Top