Arduino 各种模块篇 震动模块 vibrator module
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的更多相关文章
- Arduino 各种模块篇 震动模块 vibrator
vibrator is a good thing. it has multi-funtionality . :) Now the vibrator we choose is the one whic ...
- Arduino 各种模块篇 摇杆模块
Arduino的另外几种模块,我们常见的joystick摇杆模块. 用起来很爽,摇杆 有X,Y轴可调 这里有一篇非常想尽的示例代码: http://www.geek-workshop.com/foru ...
- Arduino 各种模块篇 蓝牙模块 手机蓝牙控制Arduino LED灯
解决方案. 条件: 1.手机android 商店下载 blueTerm 2.向arduino中载入如下代码: char val; ; void setup() { Serial.begin(); pi ...
- 转:OSGi 入门篇:模块层
OSGi 入门篇:模块层 1 什么是模块化 模块层是OSGi框架中最基础的一部分,其中Java的模块化特性在这一层得到了很好的实现.但是这种实现与Java本身现有的一些模块化特性又有明显的不同. 本文 ...
- Orchard详解--第八篇 拓展模块及引用的预处理
从上一篇可以看出Orchard在处理拓展模块时主要有两个组件,一个是Folder另一个是Loader,前者用于搜索后者用于加载. 其中Folder一共有三个:Module Folder.Core Fo ...
- Orchard详解--第七篇 拓展模块(译)
Orchard作为一个组件化的CMS,它能够在运行时加载任意模块. Orchard和其它ASP.NET MVC应用一样,支持通过Visual Studio来加载已经编译为程序集的模块,且它还提供了自定 ...
- python之常用模块篇5
一.日志模块,logging模块 1)logging模块简单使用,屏幕输出.默认级别30 import logging logging.debug( logging.info( logging.war ...
- Arduino 基于 ESP8266 配置WIFI模块
Arduino 基于 ESP8266 配置WIFI模块 使用ESP8266作为服务器,使用浏览器访问该服务器,从而控制LED灯 选择 [文件]->[示例]->[ESP8266WIFI]-& ...
- Python学习【第十一篇】模块(1)
模块 模块让你能够有逻辑地组织你的Python代码段. 把相关的代码分配到一个模块里能让你的代码更好用,更易懂. 模块也是Python对象,具有随机的名字属性用来绑定或引用. 简单地说,模块就是一个保 ...
随机推荐
- bootstrap-wysiwyg 结合 base64 解码 .net bbs 图片操作类 (三) 图片裁剪
官方的例子 是 长方形的. 我这里 用于 正方形的头像 所以 做如下 修改 #preview-pane .preview-container { width: 73px; height: 73px ...
- 批处理命令篇--配置免安装mysql 5.6.22, 以及1067错误的一个解决方法
mysql 服务启动出现1067错误的一个解决方法: 当服务启动出现1067错误时,可查看“windows 事件查看器”,发现类似错误提示 Can't find messagefile 'F:\ ...
- C# 通过ImportNode AppendChild方法合并XmlDocument,XML转为DataTable
var doc1 = new XmlDocument(); var doc2 = new XmlDocument(); XmlNode root1 = doc1.DocumentElement; do ...
- POJ 3928 & HDU 2492 Ping pong(树阵评价倒数)
主题链接: PKU:http://poj.org/problem?id=3928 HDU:http://acm.hdu.edu.cn/showproblem.php?pid=2492 Descript ...
- PE文件结构(五岁以下儿童)基地搬迁
PE文件结构(五岁以下儿童) 參考 书:<加密与解密> 视频:小甲鱼 解密系列 视频 基址重定位 链接器生成一个PE文件时,它会如果程序被装入时使用的默认ImageBase基地址(VC默认 ...
- TreeView的绑定
近期遇到了TreeView的数据库绑定问题,确实是弄了我好几天,特别是多级节点的分步绑定,最開始不分步,发现所有载入页面都卡爆了,真心让人头疼.所以放出来,给须要的朋友看看,以免大家走冤枉路. 1.仅 ...
- Spring IOC 之Bean作用域
当你创建一个bean定义的时候,你创建了一份通过那种bean定义的bean的创建类的真正实力的处方.bean的定义是一个处方 的想法是很重要的的.因为这意味着,对于一个类你可以创建很多对象实例从一个单 ...
- .net的页面在大并发下出现503错误
.net的页面在大并发下偶尔出现503错误 我们开发了一个回调页面,由一个工具负责调用,由于压力非常大,回调页面通过6台服务器负载均衡的: 最近业务系统又再次扩容,回调页面压力成倍增加,在高峰时间段偶 ...
- 读书笔记—CLR via C#线程25-26章节
前言 这本书这几年零零散散读过两三遍了,作为经典书籍,应该重复读反复读,既然我现在开始写博了,我也准备把以前觉得经典的好书重读细读一遍,并且将笔记整理到博客中,好记性不如烂笔头,同时也在写的过程中也可 ...
- QMVC
高性能.NET MVC之QMVC! ASP.NET!这个词代表者一个单词Fat!因为他总是捆绑着太多的太多的类,太多太多的各种功能!你也许会用到,如果你反编译或阅读他们开源的源码,你会不会犹如在大海中 ...