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 V4.0
Introduction
Gamepad for microbit V4.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
- Power: 3V DC (2 x AAA batteries)
- Joystick: 2 axis analog (X: P1 Y: P2) 1 axis digital (Z: P8)
- Onboard LED and vibration motor: P12
- Onboard buzzer: P0
- Keys: A(A), B(B), C(P13), D(P14), E(P15), F(P16), Z(P8)
- Dimension: 5.83x2.24inch / 148 × 57 mm
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
Result:
- When starting up, set the wireless to group 1 and initialize the value of the variable item to 0;
- 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;
- It is displayed incrementally from 1 to the number randomly generated on the LED dot matrix; And play the tone;
- Send random numbers from 1 to 6 to another motherboard wirelessly;
- 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.
Program for Maqueen Lite: https://makecode.microbit.org/_Vot7AfUW7g6D
Program for GamePad: https://makecode.microbit.org/_PtgDRughPidF
Operation Effect
Run the program, toggle the rocker, and Maqueen Lite executes as follows:
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.
Program for Maqueen:https://makecode.microbit.org/_3WRLraYKPM2y
Program for GamePad:https://makecode.microbit.org/_1WYL7aKctdav
Operation Effect
Run the program, toggle the rocker, and Maqueen Lite executes as follows:
Note: the greater the amplitude of the rocker, the faster the trolley will run.
GamePad for micro:bit V2.0
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
- Operating Voltage: 3VDC (2 AAA batteries)
- Number of Buttons: Up, Down, Left, Right, X, Y, A, B Total 8 programmable buttons
- Onboard Vibration motor × 1
- Onboard LED × 1
- Onboard Buzzer × 1
- Acrylic Floor x 1
- Acrylic Panel × 1
- Battery Box with Cover × 1
- Velcro × 2
- Copper Cylinder × 4
- Screw × 8
- Big Button ×6
- Small Button× 2
- Dimension:148x57(mm)/ 5.83*2.24in
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:
- The library of gamepad: https://github.com/DFRobot/pxt-gamePad
- Enter MakeCode
- Find Advanced > Add package
- Copy the library link and paste it in the option box
- 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:
- First, you should set the two main boards are in the 1th wireless group, so that they can communicate with each other.
- When the left button is pressed, LED dot matrix displays the scissors, and sends the number 1.
- When the down button is pressed, LED dot matrix displays the rock, and sends the number 2.
- When the right button is pressed, LED dot matrix displays the paper, and sends the number 3.
- 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 "√".
- After showing the result, clear all data.
Yacht
Graphical source program: Dice Game
Execution of the Program:
- Set the wireless to group 1 when booting, and initialize item to 0.
- 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.
- Incremental display from 0 to randomly generated number on the LED dot matrix, play the pitch and vibrate motor.
- Send 1~6 random numbers to other main boards via wireless.
- 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:
- Set the wireless to group 1.
- When different buttons are pressed, send different numbers to let the car performs different actions.
- When the button is released, the number 0 is sent to make the car stop.
Execution of the Program:
- Set the wireless to group 1.
- 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
Product Pictures: DFR0536-product pictures.rar