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. 步步详解近期大火的density_peak超赞聚类

    近期忙着在公司捣腾基于SOA的应急框架,还是前两周才在微博上看见了density_peak,被圈内好些人转载. 由于这个算法的名字起的实在惹眼,都没好意思怎么把这个算法名字翻译成中文,当然更惹眼的是, ...

  2. C语言库函数大全及应用实例十一

    原文:C语言库函数大全及应用实例十一                                         [编程资料]C语言库函数大全及应用实例十一 函数名: setbkcolor 功 能 ...

  3. POJ 2114 Boatherds 划分树

    标题效果:鉴于一棵树,问有两点之间没有距离是k的. 数据的多组 思维:和IOI2011的Race喜欢.不是这么简单.阅读恶心,我是在主要功能的别人的在线副本. CODE: #include <c ...

  4. testNg的安装与卸载

    1.testNG的安装 打开eclips,点击Help菜单.选择Install New Software. 在弹出的窗口的work with的输入框,输入http://beust.com/eclips ...

  5. JQuery在Ajax的Post提交中国乱码的解决方案

    介绍: 在JQuery的Ajax POST要求,一个要求.中国的背景之中,乱码,如何解决呢? 问题简介: var regid = $('#oregion').combobox('getValue'); ...

  6. [译]Java 设计模式之迭代器

    (文章翻译自java-design-pattern-iterator) 迭代器模式用于迭代遍历一个集合对象.它是一个经常被用到的模式,你可能以前使用过它.不管在任何时候你看见一些方法像hasNext( ...

  7. 求最短路径算法之SPAF算法。

    关于求最短路径: 求最短路径的算法有许多种,除了排序外,恐怕是OI界中解决同一类问题算法最多的了.最熟悉的无疑是Dijkstra(不能求又负权边的图),接着是Bellman-Ford,它们都可以求出由 ...

  8. java 学习List 的 add 与set差分法

    /** * 在List收集在许多方面.add(int index,Object obj)方法与set(int index,Object e)方法不易区分 * .通过以下实例.能够看出两个方法中的差别 ...

  9. 网站开发常用jQuery插件总结(二)弹出层插件Lightbox

    网站开发过程中,为了增加网站交互效果,我们有时需要在当前页面弹出诸如登陆.注册.设置等窗口.而这些窗口就是层,弹出的窗口就是弹出层.jQuery中弹出层插件很多,但有些在html5+css3浏览器下, ...

  10. Linux - 命令行 管道(Pipelines) 详细解释

    命令行 管道(Pipelines) 详细解释 本文地址: http://blog.csdn.net/caroline_wendy/article/details/24249529 管道操作符" ...