The vibrator I got works at the voltage ranging from 3.3V ~ 5.5V

I want to make it vibrate variably.

So I planned to test in 2 different ways.

1) analog valtage supply

2) PWM full valtage supply

Here's the test situations and codes

1) analog valtage supply

int vibratorPin=A1; // vibrator on A1
int i=;
void setup()
{
Serial.begin();
//pinMode(vibratorPin,OUTPUT);
pinMode(,OUTPUT); // Full valtage Pin
digitalWrite(,HIGH);
}
void loop()
{
for(i=; i < ; i=i+)
//Acutally the vibrator works from on i = 130
//analog doesn't work so ideally
{
analogWrite(vibratorPin,i); // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
Serial.print("vibration value");
Serial.print("\t");
Serial.println(i);
delay();
}
i=;
}

--analysis : only when "i" goes up more than 130 , the vibrator begins to work.

Also not very different from if just give it full voltage supply. ( digital Pin 10 as a control experiment here )

2) PWM full voltage supply

int vibratorPin=; // vibrator on Pin 9
int i=;
void setup()
{
Serial.begin();
pinMode(vibratorPin,OUTPUT);
pinMode(,OUTPUT); // Full valtage Pin
digitalWrite(,HIGH);
}
void loop()
{
for(i=; i < ; i++)
//Acutally the vibrator works from on i = 130
//analog doesn't work so ideally
{
digitalWrite(vibratorPin,i); // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
Serial.print("vibration value");
Serial.print("\t");
Serial.println(i);
delay();
}
i=;
}

--effect analysis:

Initially when variable "i" ranges from 0 to 100, I can feel the module vibrates dynamically clearly. But after "i" goes up to more than 100, I feel it all the same, which means "100" is no different from "200" for this instance.

So I re-code it.

int vibratorPin=; // vibrator on Pin 9
int i=;
void setup()
{
Serial.begin();
pinMode(vibratorPin,OUTPUT);
pinMode(,OUTPUT); // Full valtage Pin
digitalWrite(,HIGH);
}
void loop()
{
for(i=; i < ; i=i+) // Here is the part i changed , but still not different from previous one
//Acutally the vibrator works from on i = 130
//analog doesn't work so ideally
{
digitalWrite(vibratorPin,i); // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
Serial.print("vibration value");
Serial.print("\t");
Serial.println(i);
delay();
}
i=;
}

#############

Summery:

Above all, so for  this vibrator module, please don't think to use it like a vibrator variably.

Buy a digital one! Haha! Gonna get one!

Arduino 各种模块篇 震动模块 vibrator module的更多相关文章

  1. Arduino 各种模块篇 震动模块 vibrator

    vibrator is a good thing. it has multi-funtionality . :) Now the  vibrator we choose is the one whic ...

  2. Arduino 各种模块篇 摇杆模块

    Arduino的另外几种模块,我们常见的joystick摇杆模块. 用起来很爽,摇杆 有X,Y轴可调 这里有一篇非常想尽的示例代码: http://www.geek-workshop.com/foru ...

  3. Arduino 各种模块篇 蓝牙模块 手机蓝牙控制Arduino LED灯

    解决方案. 条件: 1.手机android 商店下载 blueTerm 2.向arduino中载入如下代码: char val; ; void setup() { Serial.begin(); pi ...

  4. 转:OSGi 入门篇:模块层

    OSGi 入门篇:模块层 1 什么是模块化 模块层是OSGi框架中最基础的一部分,其中Java的模块化特性在这一层得到了很好的实现.但是这种实现与Java本身现有的一些模块化特性又有明显的不同. 本文 ...

  5. Orchard详解--第八篇 拓展模块及引用的预处理

    从上一篇可以看出Orchard在处理拓展模块时主要有两个组件,一个是Folder另一个是Loader,前者用于搜索后者用于加载. 其中Folder一共有三个:Module Folder.Core Fo ...

  6. Orchard详解--第七篇 拓展模块(译)

    Orchard作为一个组件化的CMS,它能够在运行时加载任意模块. Orchard和其它ASP.NET MVC应用一样,支持通过Visual Studio来加载已经编译为程序集的模块,且它还提供了自定 ...

  7. python之常用模块篇5

    一.日志模块,logging模块 1)logging模块简单使用,屏幕输出.默认级别30 import logging logging.debug( logging.info( logging.war ...

  8. Arduino 基于 ESP8266 配置WIFI模块

    Arduino 基于 ESP8266 配置WIFI模块 使用ESP8266作为服务器,使用浏览器访问该服务器,从而控制LED灯 选择 [文件]->[示例]->[ESP8266WIFI]-& ...

  9. Python学习【第十一篇】模块(1)

    模块 模块让你能够有逻辑地组织你的Python代码段. 把相关的代码分配到一个模块里能让你的代码更好用,更易懂. 模块也是Python对象,具有随机的名字属性用来绑定或引用. 简单地说,模块就是一个保 ...

随机推荐

  1. 如何完成Nexus 9上电后激活过程

    所述被激活,因为它是Nexus 9经过努力获得启动OTA最新更新包,而且因为Google关闭一堵墙.原因无法下载更新包. 因为是第一次开机,它不能被设置usb debugging, 无法adb去杀死w ...

  2. Android自己定义控件系列五:自己定义绚丽水波纹效果

    尊重原创!转载请注明出处:http://blog.csdn.net/cyp331203/article/details/41114551 今天我们来利用Android自己定义控件实现一个比較有趣的效果 ...

  3. MapGuide应用程序演示样例——你好,MapGuide!

    图 3‑4显示了基于MapGuide的Web应用程序的开发流程,整个开发流程能够分为五个阶段.图中,矩形代表任务,椭圆形被任务使用的或被任务创建的实体,箭头代表数据流. 1) 载入文件类型的数据,配置 ...

  4. Android KitCat 4.4.2 ADB 官方所支持的所有Services格式翻译

    在之前的文章中有转帖网上同行制作的ADB协议表格<<adb概览及协议参考>>,但不够详尽,所以这里自己另外基于Android 4.4.2的技术文档重新做一次翻译. HOST S ...

  5. 使用JavaCompiler编译java源文件

    从1.6版本的JDK开始,JDK提供了标准的包可以方便的调用JVM的编译器,可以方便的使用JVM的编译器来编译java源文件.JDK提供的调用接口是JavaCompiler类,该类在JDK的tools ...

  6. PHP 14:类的实例

    原文:PHP 14:类的实例 在本章中我们将介绍一个实例,来进一步对类加深了解.本章构建一个Page类,它代表了一个页面.其中有显示页面的title,样式,内容等函数.此页面的效果如下:我们将把这个页 ...

  7. lucent检索技术之创建索引:使用POI读取txt/word/excel/ppt/pdf内容

    在使用lucent检索文档时,必须先为各文档创建索引.索引的创建即读出文档信息(如文档名称.上传时间.文档内容等),然后再经过分词建索引写入到索引文件里.这里主要是总结下读取各类文档内容这一步. 一. ...

  8. JTAG应该如何接线

    下面是某个ARM9评估板的原理图: 注意: 1. Vref和Vtarget可以直接连在一起,由被调试板提供3.3V或5V电源: 2. nTRST,最好上拉: 3. TDI,最好上拉 4. TMS,最好 ...

  9. 苹果公司的新的编程语言 Swift 高级语言(十五)--协议

    协议定义了适合某个特定任务或功能须要的方法.属性和其他需求的一个蓝图.协议本身不提供这些需求的实现,它仅仅是描写叙述了一个任务或功能实现的蓝图. 协议与java 语言中的接口定义类似,都是描写叙述了一 ...

  10. ODBC操作excel

    //ODBC连接Excel public static void main(String[] args) {  Connection conn = null;  Statement stm = nul ...