Difference between revisions of "Body Sensation"

From Microduino Wiki
Jump to: navigation, search
(Created page with "{| style="width: 1000px;" |- | ==Overview== 600px|center Use Motor module and Motion module to make an emoticon whose motor i...")
 
(Module List)
 
(One intermediate revision by the same user not shown)
(No difference)

Latest revision as of 09:34, 22 March 2017

Overview

Anywhere motion-motor-expression.jpg

Use Motor module and Motion module to make an emoticon whose motor is controlled to spin through leaning the platform left and right.

Module List

Module

Module Number Function
mCookie-Core 1 Core board
Battery box 1 Program download and power supply
Motor driver module 1 Drive a motor
Motion module 1 Detect motion, equivalent to a gyroscope
N20 gear motor 2 Rotate unceasingly

Other Equipment

  • USB cable*1
  • Lego or other fixation structures
Anywhere motion-motor-expression-module.jpg

Module Setup

Setup

Anywhere motion-motor-expression-step.jpg
  • Assemble modules and sensors together:
    • Connect two motors to Motor module;
    • Stick the red core, yellow motion module and green motor module to the yellow battery base;
    • Plug one end of USB cable into the battery base and connect the other end to computer.

Programming

Required Program Blocks

Start to Program

Motor begin Motion DMP solution Variable X is for storing the pitch motion degree Constrain X to -20~20 Map X from -20~20 to -255~255 Send X to the serial monitor The speed of the two motor is X.

Mixly-ctrl-motion-motorr-expression-code.jpg



Test the result
Before power on, confirm the motion module is level, and the x axis of motion sensor leans downward, and the two eyes turn left (anticlockwise); the x axis of the motion sensor leans upward, and the two eyes turn right (clockwise).

Anywhere motion-motor-expression.jpg



Q: Now the two eyes turn to the same direction. How to make them turn to different directions?
A: -255~0 represent rotating back, and 255~0 represent rotating forth, just change x into –x can make it rotate reversely.

Use variable Y to storing the roll motion degree. Constrain Y to -20~20. Map Y from -20~20 to -255~255. The speed of motor 1A,1B is X-Y. The speed of motor 2A,2B is X+Y.

Mixly-ctrl-motion-motorr-expression-code1.jpg

Technical Specification

Relative Cases

FAQ