Lazy Donkey

来自Microduino Wikipedia
1304410487@qq.com讨论 | 贡献2015年10月30日 (五) 08:28的版本 Schematic
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航搜索
Language English

Overview

Mr. donkey is always too lazy to work. Only by beating the table will get him work.

Schematic

Use Microduino-shake sensor to detect the beat and let the motor lead the donkey to run forward for some distance. For the running speed and duration time, users can set by yourself based on personal needs.

Equipment

Module Number Function
Microduino-CoreUSB 1 Core board
Microduino-Sensorhub 1 sensor hub
Microduino-Shake 1 Vibration sensor
Microduino-Robot 1 robot module
Microduino-Motor 1 DC motor module
Motor 1 motor

Preparation

  • Setup 1:Connect the CoreUSB module to your computer and then start the Arduino IDE
  • Setup 2:Select Files > Examples > mCookie > _304_DozingDonkey
  • Setup 3:Click upload to upload the program. When "Done Uploading" appears, the

program should have successfully been uploaded into the CoreUSB.

Program description

  • Control pin definitions explained.
#define motor_pinB 6  //Motor 1
#define motor_pinA 8  //Motor 1

//#define servo_pinB 5   //Motor 2
//#define servo_pinA 7   //Motor 2

const int vibrationPin = 10;  // Shack sensor
  • Locate the following code, where 255 is the maximum value of the motor speed, you can

adjust to any value from 0 to 255 (recommended value not less than 60, or may be

triggering Movies sensor stability).

  • Delay can be controlled motor running time, preset to 1000 ms, that one second, you can

modify it as needed.

void fullForward() {
  //digitalWrite(motor_pinB, HIGH);
  analogWrite(motor_pinB,255);//0-255
  digitalWrite(motor_pinA, LOW);
  delay(1000);
}

Hardware Buildup

  • Setup 1:Use the below diagram as reference and connect the sensors into the corresponding ports on the Hub module.
  • Setup 2:Connect the motor to the Motor module as it is shown above.
  • Setup 3:According to your project needs, you can attach the motor accessories for attachment to other devices.
  • Setup 4:Connect the activated Battery box to your Battery Management module.
CoreUSB Ble steup2.jpg
  • Setup 5:Stack all the modules together in any order you like. Congratulations, you have finished building the circuit!

Result

By beating the table once, Microduino-Shake sensor can detect the vibration and the donkey will move forward accordingly for one second.

Video