Arduino 各种模块篇 震动模块 vibrator

こ雲淡風輕ζ 提交于 2020-02-19 05:39:28

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.

 

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.

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!