Arduino 各种模块篇 震动模块 vibrator

vibrator is a good thing. it has multi-funtionality . :)

Now the  vibrator we choose is the one which looks like this:

http://www.seeedstudio.com/wiki/Grove_-_Vibrator

I am testing this vibrator which is neat.

Gvib.jpg

const int vibratorPin = 8;


void setup()
{
  pinMode(vibratorPin, OUTPUT);
}

void loop()
{
  // make it vibrate
  digitalWrite(vibratorPin,HIGH);
  delay(1000);
  // make it not vibrate
  digitalWrite(vibratorPin,LOW);
  delay(1000);
}

make it run!

then you will see it vibrate every 1 sec.

原文地址:https://www.cnblogs.com/spaceship9/p/3360911.html