Crazy Mouse

来自Microduino Wikipedia
1304410487@qq.com讨论 | 贡献2015年10月30日 (五) 07:07的版本 (Created page with "{{Language| Crazy Mouse}} {| style="width: 800px;" |- | ==Objective== Beat the mouse and it will rush forward for some distance. ==Principle== Use Microduino-Shake sensor to ...")
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航搜索
Language English

Objective

Beat the mouse and it will rush forward for some distance.

Principle

Use Microduino-Shake sensor to detect the beat and let the motor lead the mouse run for some distance.

Equipment

Module Number Function
Microduino-CoreUSB 1 Core board
Microduino-Sensorhub 1 Sensor pin board
[[Microduino-Shake] 1 Vibration sensor
Microduino-Robot 1 Robot control board
Microduino-Motor 1 DC motor drive module
Motor 1 Motor

Hardware Buildup

  • Setup 1:Stack the CoreUSB, Robot, Motor and Sensorhub together.
  • Setup 2:Connect the vibration sensor to Sensorhub D2 and the motor to Stepper's OUTIA,OUTIB.

Software Debugging

  • Description for Control Pin Definition
#define PIN_SHAKE 2    //The vibration sensor input pin 
#define PIN_MOTOR 6    //Motor output pin
  • Judge if the vibration sensor is triggered. If yes, please control the motor and run it for three seconds after the trigger.
sensorReading = digitalRead(PIN_SHACK);    //Read the status of the vibration sensor. 
if(sensorReading == HIGH)
{
  digitalWrite(PIN_MOTOR,LOW);    //The motor works for three seconds.  
  delay(3000);
  digitalWrite(PIN_MOTOR,HIGH);
}
delay(1000);

Program

[MicroduinoCrazyMouse]

Result

By beating the mouse once, Microduino-Shake can detect vibration and the mouse will rush forward for three seconds.

Video