MegaPi board test (with Arduino IDE)


#1

I wanted to detail a simple test with the MegaPi board.

I have not seen it in any other thread, so apologies if this is repetitive. Also, directions are a bit verbose (for a younger audience).

Note: if you use this test then after the test you should “Reset Default Program” afterward. See notes at end.

(this procedure is for mBlock application running on a Windows PC)

========================================================
Procedure for testing MegaPi board (using Arduino IDE):

  1. Connect MegaPi to PC via USB cable.
  2. Open mBlock application
  3. Select the following tab/menu options:
    a. Edit>Arduino Mode
  4. On the new screen, click the “Edit with Arduino IDE” (far top-right button)(the Arduino IDE will open (it is embedded in the mBlock application))
  5. Close the mBlock application (Arduino IDE will still be running).
  6. Select the following tab/menu options:
    a. File>Examples>)01.Basics>Blink
  7. In the dark blue bar just below the main tabs, click the “right arrow” icon (mouseover will say “Upload”)
  8. The compiled code will be sent to the MegaPi.

Result: Turns on an LED on for one second, then off for one second, repeatedly.

You can further test this by editing and recompiling the code. Below is an example for 3 long blinks followed by 3 short ones:

void loop() {
  digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);
  digitalWrite(13, HIGH);    //long blink #2
  delay(1000);
  digitalWrite(13, LOW);
  delay(1000);
  digitalWrite(13, HIGH);    //long blink #3
  delay(1000);
  digitalWrite(13, LOW);
  delay(1000);
  digitalWrite(13, HIGH);    //short blink #1
  delay(200);
  digitalWrite(13, LOW);
  delay(200);
  digitalWrite(13, HIGH);    //short blink #2
  delay(200);
  digitalWrite(13, LOW);
  delay(200);
  digitalWrite(13, HIGH);    //short blink #3
  delay(200);
  digitalWrite(13, LOW);
  delay(200);
}
  1. replace the loop() function with the above code.
  2. click the “checkbox” icon (dark blue bar, mouseover says “verify”)
  3. click the “upload” icon

Now the MegaPi should be blinking 3 long - 3 short (on the blue LED at the center of the board (next to Port 3)).

NB: Be sure to use the mBlock software to “Reset Default Program”

Procedure for that is below.

First, with your MegaPI connected to your PC, go to Windows Device Manager and confirm the Port connected to the MegaPi. In the below example, COM4 is used.

  1. Close Arduino IDE (if open)
  2. Run mBlock
  3. Select the following tab/menu options:
    a. Boards>Ultimate 2.0 (MegaPi)
    b. Connect>Serial Port>COM4
  4. Select the following tab/menu options:
    a. Connect>Reset Default Program>MegaPi

You may need to do a firmware re-upgrade. It’s the same as the above 4 steps, just select “Connect>Upgrade Firmware” in step 4a.

========================================================

To confirm functionality, preform the following:

  1. With MegaPi USB disconnected, attach Bluetooth module.
  2. Connect USB to pc
  3. Open Andriod/iPad Makeblock app
  4. Connect to Ultimate 2.0 per app.

The Bluetooth connection should work. Note, if your robot is connected, none of the movement commands will work.

Hope this helps!


#2