Crazy Mouse
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 |
---|
目录ObjectiveBeat 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 |