Crazy Mouse
From Microduino Wiki
Revision as of 07:07, 30 October 2015 by 1304410487@qq.com (talk) (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 • 中文 |
---|
ContentsObjectiveBeat the mouse and it will rush forward for some distance. PrincipleUse Microduino-Shake sensor to detect the beat and let the motor lead the mouse run for some distance. Equipment
Hardware Buildup
Software Debugging
#define PIN_SHAKE 2 //The vibration sensor input pin
#define PIN_MOTOR 6 //Motor output pin
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); ProgramResultBy beating the mouse once, Microduino-Shake can detect vibration and the mouse will rush forward for three seconds. Video |