Crazy Mouse
From Microduino Wiki
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 |