Introduction: Using the DF Robot Micro Maqueen Micro:Bit Robot Platform With the Arduino IDE

About: I am a Ham Radio operator, computer geek, robotic hobbyist. I've been "playing" with microcontrolers for the last several years, basic stamps, arduinos, and arduino like controllers, Raspberry PI, PICs & PICax…

The DF Robot micro Maqueen Robot Platform is a great little inexpensive robot that uses the BBC Micro:Bit micro-controller for it's brains. This project is an attempt to duplicate the examples DF Robot provides for Makecode - but using the Arduino IDE. (For those of us that don't like Scratch, or Makecode).

For full disclosure DF Robot provided the Maqueen, a BBC Micro:Bit, and a micro:Gamepad (which in the end I did not use in this project, but will still explain how to use it with the Arduino IDE - super easy to do).

I also added a HC-SR04 ultra sonic sensor, which is somehting that I already had, and can be found in a number of different on line stores.

For this project the following is need:

micro:Maqueen Robot Platform https://www.dfrobot.com/product-1783.html about $20.90 US

BBC Micro:bit https://www.dfrobot.com/product-1587.html $14.90 or

BBC Micro:bit Go KIT https://www.dfrobot.com/product-1625.html $16.45 (recommended)

and a HC-SR04 ultrasonic (eBay, Aliexpress, ect, should be easy to find) <$2.00

Also provided (by DF Robot) but not used for this project:

micro:Gamepad https://www.dfrobot.com/product-1711.html $19.90

Step 1: What Is the Micro:Maqueen Robot Platform (Features)

Out of the box it supports Makecode, and will support scratch and python (in the future) - (And mostly) support for Arduino IDE using this guide.

It is small, flexible movement, all metal miniature gear motors, it has a line following sensor (called Line Patrol),

can do ambient light, 2 LEDs, ultrasonic interface, buzzer, I2C interface, future expansion screw holes.

It also has a IR reader/receiver, 4 neopixels.

The Micro:bit has a 5x5 LED matrix (which supports light detection), 2 programmable button, motion detector, compass and Bluetooth smart, it is programmable with Makecode, scratch, python, mbed and Arduino IDE.

It is a 32-bit Arm Cortex M0 CPU.

This guide will show how to install everything you need to make this work with the Arduino IDE, examples that closely match the Makecode examples have been provided.

I have found a couple of limitations with using the Arduino IDE, and as of right now have not found a solution.

  1. Neopixels (ws2812) do not appear to work on P15 (pin 15) with the Arduino.
  2. Radio/Peer To Peer do not appear to work - BLE (Bluetooth) does work, and a work around is to use this with an app on a tablet or phone for remote control.
  3. unable or unsure how to multitask - music/sound effect are blocking functions currently.
  4. IR remote (more on this later - but) I used a very old method to read the IR codes, this works but is a lot more picky, and can cause the wrong code to be send if you hold the remote button down.

Step 2: Install the BBC Micro:Bit Into the Arduino IDE

I will be referring to Adafruits Tutorial for this step. https://learn.adafruit.com/use-micro-bit-with-ardu...

The video above shows additional steps needed if you are a Linux users, for Windows 10 users the install is straight forward, and didn't cause me any problems. * I don't have a Windows 7 system, so I don't know about the additional step in the tutorial. Nor do I own a Mac or OSX device, so hopefully you'll not have problems - but remember google is your friend if you do.*

FOR LINUX users this addition sites were very helpful:

udev rules were found here: https://github.com/RedBearLab/nRF51822-Arduino/iss...

And addition libraries which are needed were found on the arduino-nRF5 board core project page:

https://github.com/sandeepmistry/arduino-nRF5/blob...

Also for Linux users your USER must be part of the dial up group (or the "Connect to Internet using a modem" group) or maybe (depending on your distro the Use modems group) - Generally this setting is found under Administration and "Users and Groups"

Steps in common with all OSes:

  1. In Arduino, go to Preferences and add 'https://sandeepmistry.github.io/arduino-nRF5/package_nRF5_boards_index.json' into the Additional Board Manager URL Text box.
  2. Open Tools>Board>Boards Manager from the menu bar, search for nRF5 and install "Nordic Semiconductor nRF5 Boards" by Sandeep Mistry - This step takes a while, and installs a number of things needed, just be patient.
  3. Once done, look for the BBC Micro:Bit in the Tools>Board List of boards. And select it.
  4. Next you'll want to open Tools and look for Softdevice change that to S110.
  5. Last plug the BBC Micro:bit into your computer, if this is the first time, (Windows will install device drivers) (Linux it should just open a folder up), either way, you'll need to look at Tools and select the right serial Port for your board.

At this point, Linux users will likely need to follow the above link to install additional libraries, and probably need these udev rules settings:

bapowell wrote on Sep 4, 2016
After ensuring that my userid was a member of the plugdev group, I created a new udev rules file, /etc/udev/rules.d/98-blenano.rules, with these rules; then reloaded with $ sudo udevadm control --reload-rules, plugged in the MK20 device, and it worked.
# mbed CMSIS-DAP

ATTRS{idVendor}=="0d28", ATTRS{idProduct}=="0204", MODE="664", GROUP="plugdev" KERNEL=="hidraw*", ATTRS{idVendor}=="0d28", ATTRS{idProduct}=="0204", MODE="664", GROUP="plugdev"


Now you should be able to upload the sample code from the Adafruit tutorial, and you should see a LED on the matrix blinking.

const int COL1 = 3; // Column #1 control

const int LED = 26; // 'row 1' led

void setup() {

Serial.begin(9600);

Serial.println("microbit is ready!"); // because the LEDs are multiplexed, we must ground the opposite side of the LED

pinMode(COL1, OUTPUT);

digitalWrite(COL1, LOW);

pinMode(LED, OUTPUT);

}

void loop(){

Serial.println("blink!");

digitalWrite(LED, HIGH);

delay(500);

digitalWrite(LED, LOW);

delay(500);

}

Some Install Notes at this point:

IF this still doesn't work you may need a softdevice installed on your Micro:bit, Adafruit has a simple one here:

https://learn.adafruit.com/use-micro-bit-with-ardu...

Windows 7 users need to install the serial driver BEFORE plugging in the Micro:bit please see above link for driver.

** While video above is semi-general, it is specifically for Linux users. **

If you need addition help, please see the above links for more information, and specific support for each of these steps.

Once you have a working "Blinky" - we need to install some libraries that will make life so much easier.

The Magnetometer and Accelerometer library can be found in the Adafruit Tutorial, these libraries need to be installed manually - Adafruit has a great tutorial if you don't know how to do that. (Library is really a Sparkfun Library - How cool is that) https://learn.adafruit.com/use-micro-bit-with-ardu...

The other libraries can be found in the library manager:

https://learn.adafruit.com/use-micro-bit-with-ardu...

Sketch->Include Library->Library Manager

  1. "BLE Peripheral Library" by Sandeep Mistry
  2. "Adafruit GFX Library" by Adafruit
  3. "Adafruit Microbit" by Adafruit
  4. "Maqueen" by LeRoy Miller
  5. "NewPing" by unknown

* The Adafruit Tutorial goes on to explain more about the LED Matrix, Bluetooth and other GPIO pins - it should be a good read for anyone wanting to use the BBC Micro:Bit with Arduino. There is also additional HALP page explaining a bit more about the softdevice.

Step 3: Let's Get Started - My Micro:Maqueen Library

The library can be found here, you should have installed it from the previous step.

https://github.com/kd8bxp/micro-Maqueen-Arduino-Li... Please feel free to clone and add to the examples.

(or if you know of a better way to get any of this done, feel free to let me know. I have spent some time on this, and think it is all working the way it should, but again, anything that might be an issue, let me know.)

So here is what you need to know about the library:

General Usage:

#include <Maqueen.h>
Maqueen bot;

void setup() {
bot.begin();
}

void loop() {
//do some stuff
}

  • the library includes both Adafruit_Microbit.h and NewPing.h in it, but they still need to be invoked in your sketch to be used. (In otherwords, you don't need to have a line like: #include <Adafruit_Microbit.h> because it's in the library already. (See my examples)
  • These words are defined in the library, and can be used in your sketch.
    • LED1 left LED (red)
    • LED2 right LED (red)
    • PATROLLEFT left line sensor
    • PATROLRIGHT right line sensor
    • CW and CCW motor directions, clock-wise and counter clock-wise
    • M1 left motor
    • M2 right motor
    • BUZZER connected to PIN 0, this is the buzzer
    • IR the IR receiver on the front of the robot.
    • BTNA button A
    • BTNB button B
    • TRIGGER_PIN and ECHO_PIN used for the NewPing library/ultrasonic
  • Functions:
    • bot.begin(); required, sets pin modes, and generally sets everything to initial values
    • bot.setSpeed(int speed) this will set the speed for both motors, this is a percentage from 1 to 100 with 1 being the slowest speed, and 100 being the fastest. (Which in PWM is about 20 to 255)
    • bot.motorRun(int motor, int direction, int speed); this let you control each motor indepentant of each other, int motor (M1 or M2), int direction (CW or CCW), and int speed (This is in PWM value 0 to 255). This was put in the library because this how DF Robot has it's Makecode libary setup, and I thought it might be easier to "convert" the programs.
    • bot.stop(); stops both motors, this also sets the speed back to zero, see example sketches
    • bot.forward(); robot moves forward. will continue to move forward until either a stop is called, or another direction is called.
    • bot.backward(); same as above, only going backward.
    • bot.spinLeft(); spin in place to the left, will continue to do so until a stop or another direction is called.
    • bot.spinRight(); same as above to the right.
    • bot.left(); turn left, will continue until a stop or another direction is called.
    • bot.right(); same as above to the right.
    • bot.readIR(); returns a bytevalue code if a IR code is received. (semi-blocking)
    • bot.readPatrolLeft(); and bot.readPatrolRight(); returns a bool (1 or 0) of the current state of the line sensors.
    • bot.readA(); and bot.readB(); returns if the buttons have been pushed (bool 1 or 0)

Next we have some interesting sounds/sound effects/music. PLEASE NOTE all sounds are BLOCKING. Be aware some of these are long, your robot will not be able to do anything while it is playing a sound. *This is a known issue that I want to correct. Please make sure the motors are stopped, or it is not doing anything important if you play a sound. **

  • bot.squeak(); this is the startup sound that is played.
  • bot.catcall();
  • bot.ohhh();
  • bot.laugh();
  • bot.laugh2();
  • bot.waka(); pac-man like sound, very long
  • bot.r2d2(); sorta sounds like r2 (no not really).
  • bot.scale(); play the musical scale
  • bot.uhoh();
  • bot.error();
  • bot.sos();
  • bot.beep(float noteFrequency, long notDuration); used if you want to make your own music or sound effects

The Adafruit Microbit libary provides lots of useful features for the LED Matrix, and BLE functions. Please look at the examples they provide for more information. I've added a few more "images" for display.

From Adafruit:

  • microbit.show(microbit.HEART);
  • microbit.show(microbit.EMPTYHEART);
  • microbit.show(microbit.NO); big x or cross
  • microbit.show(microbit.YES); check mark

Images added: (* Notice how they are called a little differently), Also note, serveral of these are images used on the Makecode site.

  • microbit.show(smile_bmp); a smile face (used in most of the sketches). This was in one of Adafruits examples, and moved to be included with this library.
  • microbit.show(sad); a sad face
  • microbit.show(confused); a confused face
  • microbit.show(small_heart)
  • microbit.show(ghost); a ghost - pacman anyone(?)
  • microbit.show(skull)

Some of my own images:

  • microbit.show(up_arrow);
  • microbit.show(down_arrow); - Called a sword on Makecode
  • microbit.show(right_arrow);
  • microbit.show(left_arrow);

Step 4: Examples 1 (Motor) and 7 (Line Follow)

As stated earlier, I was attempting to duplicate as many of the DF Robot Makecode examples as I could.

The first of which is Motor Control.

#include <Maqueen.h>

Maqueen bot;
//NewPing.h and Adafruit_Microbit.h are inlcuded the library header

//but still need to be invoked here.

Adafruit_Microbit_Matrix microbit;

void setup() {

bot.begin();

microbit.begin(); while (bot.readA()) {

//wait for BTNA to be pushed

microbit.print("A"); } microbit.clear();

microbit.show(smile_bmp); //Spin the motor to the right

bot.motorRun(M1, CW, 50); //Motor Number, direction, speed (PWM)

bot.motorRun(M2, CCW, 50);

delay(5000); //wait 5 seconds

bot.stop(); //turn motors off

//Set speed by percentage (0 to 100) slow to fastest. For both motors resets when stopped

bot.setSpeed(50);

bot.spinLeft(); //Spin robot in place to left

delay(5000); //wait 5 seconds

bot.stop(); //turn motors off speed set to zero}

void loop() { }

This example shows how to use bot.motorRun(x,x,x) and also how bot.setSpeed(x) and bot.spinLeft(); work.

It's a simple example to make the motors move. * It should be noted, that the BUTTON is HIGH until it is pushed, then it goes low.

Example number 7 is Line Following.

My sketch turned out to be very different than the Makecode code.

#include <Maqueen.h>

Maqueen bot;
//NewPing.h and Adafruit_Microbit.h are inlcuded the library header

//but still need to be invoked here.

Adafruit_Microbit_Matrix microbit;

//on the makeblock line map

//Black Line returns a Zero (0)

//White returns a one (1)

int speed = 10; //this is a percentage from 1 to 100

void setup() {

Serial.begin(9600);

bot.begin();

microbit.begin(); while (bot.readA()) { //wait for BTNA to be pushed

microbit.print("A");

} microbit.clear();

microbit.show(smile_bmp);

} void loop() { bot.setSpeed(speed);

if (bot.readPatrolLeft() == 0 && bot.readPatrolRight() == 0) { bot.forward(); }

if (bot.readPatrolLeft() == 1 && bot.readPatrolRight() == 0) { bot.right(); }

if (bot.readPatrolRight() == 1 && bot.readPatrolLeft() == 0) { bot.left(); }

if (bot.readPatrolRight() == 1 && bot.readPatrolLeft() == 1) { bot.spinLeft(); }

}

The idea here is that the robot should "follow the black line" the line returns a zero on both sensors if they are over it, so it should go in a straight line. And if either line sensor goes high, the robot should turn to the opposite direction. (IE: if the left sensor goes high, we turn right to get back on the line), and if both sensors go high, we spin the robot in place until we find the line again.

Step 5: Examples 3a (Blink LED), 6a (Get IR Codes), LED Matrix Demo

The video above shows the a couple of more examples - I am going to show some abbreviated code for sketch 3a

void loop() {

digitalWrite(LED1,HIGH); //LED1 is defined in the library (left led)

digitalWrite(LED2,LOW); //LED2 is defined in the library (right led)

bot.beep(note_C6, 500); //this function is blocking and will create the delay

digitalWrite(LED1, LOW);

digitalWrite(LED2, HIGH);

bot.beep(note_E6, 500);
}

In this example, we are using the "unwanted" blocking produced by the sound effects, to create a delay for blinking the LEDs. It's an interesting way to use something that really isn't what was wanted, and still achieve the desired effect.

The IR Receiver: I was about to give up on using the IR receiver with the Arduino, all of the IR receiver libraries I found failed to compile, and caused so many errors that I just didn't have the time to deal with it. Many years ago I did come across away to read IR receiver using pulseIn, and after some searching I finally found the original code. http://pscmpf.blogspot.com/2010/01/arduino-and-ir...

As you can see this code is from 2010, but amazingly it does work (with some help). The basics of it is that it counts the pulses. This has some problems, if you hit and hold the button on the remote you'll get a different code, if the receiver only sees part of the IR signal you'll get the wrong code. What you have to do is hit the same button on the remote a number of times, make a note of all the numbers it produces - you may see that sometimes numbers are duplicated with different buttons (These numbers should be rejected, as they are not real). It will take some trail and error to setup your robot for IR remote control. And it works better if you can hit the remote buttons the same way each time. Example 6a will display the code on the Micro:Bit LED Matrix and in the Serial console of the Arduino IDE, hit each button on the remote and make a list of which button and what numbers it produces - You will need these number for example 6 IR Remote control.

LED Matrix Demo as the name suggests this displays all the images from both the Adafruit Microbit library, and micro Maqueen library. This is really one of Adafruits examples, with the additions of images included in the Maqueen library.

Step 6: Example 4 (Ultrasonic Display) and 8 (Light Sensor)

In the picture above you can see a small block of 2x4 female header pins, the front of this is where the HC-SR04 ultrasonic goes, it's pins are GND, E (P2), T (P1), and VCC. It matches these ultrasonic modules great! But could be used for something else (I think, mind the voltages here I am not sure the pins are 5v).

The 2nd set of pins is for I2C, and it's D, C, -, +.

The Ultrasonic Display sketch closely matches the DF Robot example, with the addition of also displaying the distance to the serial console.

#include <Maqueen.h>

Maqueen bot;
//NewPing.h and Adafruit_Microbit.h are inlcuded the library header

//but still need to be invoked here.

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.

Adafruit_Microbit_Matrix microbit;

void setup() {

Serial.begin(9600);

bot.begin();

microbit.begin();

while (bot.readA()) { //wait for BTNA to be pushed

microbit.print("A");}

microbit.clear();

microbit.show(smile_bmp); } void loop() {

int us = sonar.ping_in();

microbit.print(us);

Serial.println(us);

delay(1000); }

As you can see from the example above it is very much the same as one of the NewPing examples, just changed enough for display on the LED Matrix. You will note that both Adafruit Microbit and NewPing need to be invoked, but are included in the Maqueen library, and don't need to included in the sketch.

The LIGHT Sensor This is based on code found from Sparkfun, and while I understand what is going on here, I am not 100% sure I could explain it - so I am just going to refer you to the Sparkfun page that explains it.

https://www.sparkfun.com/news/2161

This sketch works sort the opposite of what you might expect, this may be my fault, but it does work.

So what happens here is we are reverse biasing one of the LEDs on the Matrix, when light is shown on this our counter drops and we can move the robot. This works surprisingly well, but as you can see in the video it is slow to respond when the light is removed. Still it is very interesting.

** As a side note, I did try to use the LEDs on the Maqueen platform, and got some very weird results - these LEDs may not beable to go into reverse bias - This is the way I thought DF Robot was doing it, I was wrong **

Step 7: Example 2 Avoid

In this example we are using the HC-SR04 ultrasonic to avoid "hitting" things. This uses the NewPing libary.

As long as the ultrasonic returns some number that is larger than 5 inches the robot will move forward at a speed of 80%. As soon as the ultrasonic returns a number under 5, the bot will stop, the speed will goto 60% and a spin will turn the robot, it will stop again, increase the speed back to 80% and keep going, as long as there is nothing in it's way. This works really well, and in this case I am not making a lot of comparisons, I am just letting the while statement handle it.

#include <Maqueen.h>
Maqueen bot;

//NewPing.h and Adafruit_Microbit.h are inlcuded the library header

//but still need to be invoked here.

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.

Adafruit_Microbit_Matrix microbit;

void setup() {

Serial.begin(9600);

bot.begin();

microbit.begin();

while (bot.readA()) { //wait for BTNA to be pushed

microbit.print("A");}

microbit.clear();

microbit.show(smile_bmp);

}

void loop() {

bot.setSpeed(80); //percentage from 1 to 100

while (sonar.ping_in() >= 5) {

bot.forward();

}

bot.stop();

bot.setSpeed(60);

bot.spinLeft();

delay(100);

bot.stop();

}

Step 8: Example 6 IR Remote Control

Previously in step 5 we used the code from example 6a to get the IR codes, those codes are going to be used for example 6.

#include <Maqueen.h>
/* Define our IR Codes

* Use example 6a to get your IR codes, you may see three or four different codes

* Some trail and error will be needed to get the correct codes.

* A you can see from my example, the UP button produced 3, 64, 15 - 64 worked

* most of the time. The other buttons all had different codes. */


//for this experiment we are only going to use 5 buttons on the remote

#define UP 64 //(3 || 64 || 15)

#define LEFT 7 //(7 || 127)

#define RIGHT 9 //(9 || 39)

#define DOWN 25 //(25 || 103)

#define SETUP 21 //(87 || 21) Maqueen bot; //NewPing.h and Adafruit_Microbit.h are inlcuded the library header

//but still need to be invoked here.

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.

Adafruit_Microbit_Matrix microbit; int byteValue;

int speed = 50; //50% of full speed void setup() {

Serial.begin(9600);

bot.begin();

microbit.begin();

microbit.clear();

microbit.show(smile_bmp); }

void loop() {

byteValue = bot.readIR(); switch (byteValue) {

case 0:

bot.stop();

break;

case UP:

bot.setSpeed(speed);

bot.forward();

break;

case DOWN:

bot.setSpeed(speed);

bot.backward();

break;

case LEFT:

bot.setSpeed(speed);

bot.spinLeft();

break;

case RIGHT:

bot.setSpeed(speed);

bot.spinRight();

break;

case SETUP:

bot.stop();

break;

default:

bot.stop();

break;

}

byteValue = 0;

}

So as you can my remote has arrow keys, and a "setup" button, the numbers I got from those keys are listed in the #defines and a little trail and error was used to figure out which codes worked the best. I keep the sketch fairly simple, with only forward, spinLeft, spinRight, backward, and stop being used - so five keys.

A more advanced setup could include keys to control the speed or to flash the LEDs or "honk" a horn.

You'll want to use the codes you got from step 5 (get ir codes), and figure out what you want to call up, down, left, right, and setup. UP = forward, DOWN = backward, LEFT = spinLeft, RIGHT = spinRight, SETUP = STOP

In the loop, we call the bot.readIR(); function, which returns a number if a button is has been pushed. That number is then used with a switch/case statement to preform the set task. IF the wrong code is received, then the default task of "stop" is used. The code is then reset to zero, and the cycle starts over.

It takes a lot trail and error to get the IR receiver to work correctly, but I've already outlined why that is.

Step 9: Example 5 BLE Controller

As I stated many times in this instructable already, I wanted to duplicate as many of the DF Robot examples as I could. Unfortunately, I couldn't find a way for the peer-to-peer function of the BBC Micro:Bit to work.

This was the next best thing, thou it works very different - it is effectively still a wireless remote control.

The sketch is a slightly modified version of the Adafruit BLE controller example, I removed some of the things that I just thought I wouldn't need. And added the motor commands from my micro:Maqueen library.

The Adafruit Android app can be found here:

https://play.google.com/store/apps/details?id=com....

Open the app, and find your Micro:bit in the list of Bluetooth devices (you don't need to pair it first, in fact it is better if you don't pair it). Once connected, You should see a list of "services", click on the "controller" and then "control pad", Now you should see four arrows, and a number pad. Again, I keep this simple, I am only using the arrows. The interesting thing about this app is it sends when the button is pushed, and when it is released.

So for the sketch, each time the button is released, we stop, each time it is pushed we move. Nice and simple.

The other buttons are 1, 2, 3, 4 and that is the number you would use in the sketches if you wanted to expand on this example, for example speed control, or flash the leds, or honk a horn.

I highly recommend using the "ble_uartdemo" sketch that is included in the Adafruit Microbit library, I learned quite a bit from hitting buttons on the app while watching the uart.

The original "ble_controller" sketch is also included in the Adafruit Microbit library.

Step 10: What Is in the Examples/More Folder

I've included a version of the "avoid" sketch, that does some animations of a happy and sad face, and flashes the leds as it is "avoiding" things. I don't have a video of it, so prepare yourself to be surprised! :-).

There is another version of example 3 "blink led" sketch, this one doesn't have sound with it.

In the "Just for Fun" directory, we have some animations, that are not named well (the code needs to be cleaned up a little) these were included to just show off some of the fun things you can do with a simple LED matrix.

We have a "pac-man" animation, with sound, it's not as good as it could be. I was thinking about some sort of "pac-man" style game using the ghost image on another micro:bit.

And we have part of the "Super Mario Theme", this was to really show how you can use the bot.beep() function to make your own sounds/music

in the Testing directory, I have several "task" sketches, that I was looking at to try and make different threads working. They are in the testing stages because I am still working on them, and figuring out if they are really multi-task, or if they still do some blocking.

Step 11: Sound Effects/Music

I don't have any "example" code for this, but I did make a little video that shows the sound effects, and some of the music effects. Remember sounds are all blocking functions at this time.

Step 12: The Micro:GamePad

The micro:GamePad ($19.90) https://www.dfrobot.com/product-1711.html

This is a very well constructed and easy to use Gamepad. And even thou I didn't use it for this project, I will find something to make with it.

Specification:

  • Operating Voltage: 3vdc (2 aaa batteries)
  • 8 programmable buttons
  • onboard vibration motor
  • onboard LED
  • onboard buzzer
  • Acrylic case

I wrote a simple sketch for it, it doesn't do much, buzzes the buzzer, makes the vibration motor go, and flashes the led, and prints the name of the button pushed to the LED matrix.

#include <Adafruit_Microbit.h>

Adafruit_Microbit_Matrix microbit;

const int DOWN = 13; const int LEFT = 14; const int UP = 8; const int RIGHT = 15; const int X = 1; const int Y = 2; const int LED = 16; const int BUZZER = 0; const int VIBRATE = 12; const int A = 5; const int B = 11;

void setup() { Serial.begin(9600); microbit.begin(); pinMode (UP, INPUT); pinMode (DOWN, INPUT); pinMode (LEFT, INPUT); pinMode (RIGHT,INPUT); pinMode (A, INPUT); pinMode (B, INPUT); pinMode (X, INPUT); pinMode (Y, INPUT); pinMode (LED, OUTPUT); pinMode (BUZZER, OUTPUT); pinMode (VIBRATE, OUTPUT); //digitalWrite(IR, HIGH); analogWrite(BUZZER, 2055); digitalWrite(VIBRATE, HIGH); delay(100); analogWrite(BUZZER, 0); digitalWrite(VIBRATE, LOW);

}

void loop() { digitalWrite(LED, HIGH); analogWrite(BUZZER, 2055); digitalWrite(VIBRATE, HIGH); if (digitalRead(UP) == 0) {microbit.print("U");} if (digitalRead(DOWN) == 0) {microbit.print("D");} if (digitalRead(LEFT) == 0) {microbit.print("L");} if (digitalRead(RIGHT) == 0) {microbit.print("R");} if (digitalRead(X) == 0) {microbit.print("X"); } if (digitalRead(Y) == 0) {microbit.print("Y"); } if (digitalRead(A) == 0) {microbit.print("A"); } if (digitalRead(B) == 0) {microbit.print("B"); } delay(250); digitalWrite(LED, LOW); analogWrite(BUZZER, 0); digitalWrite(VIBRATE, LOW); delay(250); }

This isn't included in my github repository, thou I may change my mind and include it one day. For now you can only find it here! LOL.....

Step 13: Few More Pictures, Wiki Entry, and Final Thoughts.

For the Makecode/Scratch and more information about the micro:Maqueen Robot please visit the DF Robot Wiki

https://www.dfrobot.com/wiki/index.php/Micro:Maque...

I leave you with the hopes that I've added value to the micro:Maqueen Robot, and opened the door for more possible Arduino usage.