MDesigner: Live mode

From Microduino Wiki
Revision as of 18:01, 23 July 2018 by Sonny (talk | contribs) (Switching to Arduino Mode)
Jump to: navigation, search

The primary methods of using Microduino modules with mDesigner is with Live and Arduino mode. Each mode as it own pros and cons. Determining the right mode is up to the user per use case. Although, it is recommended to start with "Live" mode for testing then switching to "Arduino" mode later.

Live mode is regular Scratch, but with added blocks which are designed to interact with Microduino modules. This means the user has access to the stage and actor blocks. Projects (hardware) need to be connected to the computer running mDesigner. mDesigner communicates with the project (hardware), namely the Core module, in "real time" over the USB connection by sending commands for the Core module to perform. This means that "Live" mode requires a constant connection with the computer running mDesigner.

Arduino mode acts as a "visual" drag and drop coding editor. The script (code) is converted to "Arduino" code and then compile and uploaded to the attached Core module. This means that code can run even when detached from the computer. The stage and actor are disabled in this mode since the code runs independent of mDesigner.

Capability Live Mode Arduino Mode
Drag & Drop programming Yes Yes
Supports Microduino modules Yes Yes
Stage and actor enabled Yes No
Real time code testing Yes No
Code compiled and uploaded No Yes
Can run WITHOUT being connect to computer No Yes


Live Mode

Live mode is the default mode when using mDesigner. It allows the user to use mDesigner as if it was Scratch, but with the ability to use Microduino modules. The user must upload a special firmware on the Core / Core+ module first in order to use this mode. A firmware is code that runs on the core module itself. This special firmware is designed to accept commands from mDesigner directly and performs the requested commands.

Communication Overview

The communication between mDesigner running on a computer and the project (hardware) is outlined below.

MDesigner mBattery Live Mode.png
MDesigner Live Mode.png
Computer:
Computer running mDesigner sends commands or receives data with mBattery/mCenter+ over USB.
mBattery/mCenter+:
mBattery/mCenter+ acts as a communication bridge with the Computer (running mDesigner) and the Core/Core+ module.
Core/Core+:
  • The Core/Core+ module must be programmed with a special firmware designed to work with mDesigner. See Section Preparation
  • The Core/Core+ module receives commands from mBattery/mCenter+ which originate from the Computer running mDesigner. Core/Core+ performs the requested commands.
  • The Core/Core+ module can send back information (if requested) back to mBattery/mCenter+ which ends up at the computer running mDesigner.

Connected to Computer Requirement

In this mode, to control the modules, the user will need to have their project (hardware) connected to the computer sending commands in real time.

Note: If the project (hardware) is disconnected from the computer running mDesigner, then the project (hardware) will stop receiving commands and thus does nothing.
MDesigner mBattery Live Mode Disconnected.png
MDesigner Live Mode Disconnected.png
Computer:
Computer running mDesigner cannot send commands or receive data with mBattery/mCenter+ over USB since it is disconnected.
Core/Core+:

The Core/Core+ module is no longer receiving commands and does nothing.

Preparation

A firmware is a program that runs on core modules such as the Core and Core+. Live mode requires a special firmware to be uploaded prior to use.

Note: The special firmware only needs to be programmed once unless it is overwritten.
Using Arduino mode and uploading a program will overwrite the special firmware, thus a re-programming of the special firmware will be necessary in order to use Live mode again.

Hardware Preparation

  • Ensure drivers are properly installed by following the mDesigner getting started guides.
  • Connect to the computer with a USB cable with either a:
    • mBattery with a stacked Core / Core+ module.
    • mCenter+
  • Ensure that mBattery / mCenter+ is powered on.

MDesigner mBattery Live Mode Hardware Preparation.png


MDesigner Live Mode Hardware Preparation.png

Upload the Firmware

  1. Open mDesigner.
    :MDesigner Flash Firmware 1.png

  2. Select the port mBattery / mCenter+ is connect to.
    :MDesigner Flash Firmware 2.png

  3. Under Settings (gear icon) select Flash firmware and select mCookie. Uploading will start.
    :MDesigner Flash Firmware 3.png MDesigner Flash Firmware 4.png MDesigner Flash Firmware 5.png

  4. Once complete, select the port mBattery / mCenter+ is connected to again to begin using mDesigner with Microduino modules.
    :MDesigner Flash Firmware 6.png MDesigner Flash Firmware 2.png

Note: Ensure the top says Ready when using Live mode. This means that the hardware and mDesigner are ready.
The COM port must be re-selected if restarting mDesigner or when re-connecting the mBattery / mCenter+.
MDesigner Live Mode Ready.png

Usage

Once your script is assembled and ready. To start your script simply click on the block set to activate it. (A block set is a connected set of blocks.)
If your block set has a When Green Flag Clicked block on top of it, then the block set can be activated by the green flag on the top right of mDesigner.

  • A: Click anywhere on the block set to activate it.
  • B: Click on the Green flag to activate ALL block sets which start with the When Green Flag Clicked Block.png block (When Green Flag click block).

MDesigner Live Mode Usage 1.png


To stop all currently running blocks, click on the Stop Sign on the top right of mDesigner.

Note: Running blocks will be highlighted in yellow.

MDesigner Live Mode Usage 2.png

Arduino Mode

Arduino is a special mode which can be enabled. It acts as a drag and drop editor for programming. The Stage and Actor is disabled and many Block Categories cannot be used.
The main advantage of using Arduino Mode is that code is gennerated, compile, and uploaded. This means that the user can disconnect the project (hardware) from a computer and it can still work.

Programming Overview

The programming of a sketch (program) is outlined below.

MDesigner mBattery Live Mode.png
MDesigner Live Mode.png
Computer:
Computer running mDesigner (in Arduino mode) compiles the sketch (program) and sends the compiled code to mBattery/mCenter+.
mBattery/mCenter+:
mBattery/mCenter+ contains a programmer which programs the Core/Core+ module with the compiled code.
Core/Core+:
The compiled code is programmed/flashed onto the Core/Core+ module. The compiled code can run independent of mDesigner and can be disconnected from the computer.
Note: After uploading the compiled code onto the Core/Core+ the project can be disconnected and can run independent of the computer and mDesigner.
MDesigner mBattery Live Mode Disconnected.png
MDesigner Live Mode Disconnected.png
Core/Core+:
Compiled sketch (program) is programmed directly onto the Core/Core+ module and can run independently of a computer and mDesigner.

Usage

Hardware Preparation

  • Ensure drivers are properly installed by following the mDesigner getting started guides.
  • Connect to the computer with a USB cable with either a:
    • mBattery with a stacked Core / Core+ module.
    • mCenter+
  • Ensure that mBattery / mCenter+ is powered on.

MDesigner mBattery Live Mode Hardware Preparation.png


MDesigner Live Mode Hardware Preparation.png

Switching to Arduino Mode

In order to use Arduino mode it must be switched to in mDesigner.

  1. With mDesigner open. Click on the Arduino icon.
    :MDesigner Arduino Mode 1.png

  2. mDesigner will now switch to Arduino mode.
    :MDesigner Arduino Mode 2.png

  3. Select the COM port that mBattery/mCenter+ is connected to.
    :MDesigner Arduino Mode 3.png

  4. Ready or Connected should display.
    :MDesigner Arduino Mode 4.png
Note: Using Arduino mode and uploading a program will overwrite the special firmware used in Live mode, thus a re-programming of the special firmware will be necessary in order to use Live mode again.


Once your script (code) is assembled and ready. Click on the "upload" on the top right of the mDesigner window [image]. mDesigner will now attempt to compile the script. If not successful, mDesigner will inform of an error. If successful, the compile script will be uploaded onto the core module.