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对象,具有随机的名字属性用来绑定或引用. 简单地说,模块就是一个保 ...
随机推荐
- android 如何加入第一3正方形lib图书馆kernel于
注意:只能lib图书馆kernel编译到位.例如下列: alps/kernel/ alps/mediatek/custom/common/kernel/ alps/mediatek/custom/$p ...
- 从源代码上分析ListView的addHeaderView和setAdapter的调用顺序
ListView想要加入headerview的话,就要通过addHeaderView这种方法,然后想要为ListView设置数据的话,就要调用setAdapter方法了.可是,在调用addHeader ...
- ios背景更新和下载
ios背景更新和下载 by 吴雪莹 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NS ...
- javascript脚本化文档
1.getElememtById /** * 获取指定id的的元素数组 */ function getElements(/*ids...*/) { var elements = {}; for(var ...
- bootstrap-paginator 分页插件笔记
[MVC]bootstrap-paginator 分页插件笔记 bootstrap-paginator基于bootstrap框架,使用起来非常简单.官网:http://harttle.github ...
- CentOS下JAVA WEB 环境搭建
首先介绍下我的软件环境.虚拟机Vmware9.0(已经汉化),CentOS6.4(选择安装语言为简体中文),xshell4.0(强大的安全终端模拟软件),xftp4.0(FTP工具). 方便大家环境搭 ...
- 更改MYSQL数据库不区分大小写表名
今天郁闷死了,在LINUX下调一个程序老说找不到表,但是我明明是建了表的,在MYSQL的命令行下也可以查到,为什么程序就找不到表呢? 后来请教了一个老师才搞定,原来是LINUX下的MYSQL默认是要区 ...
- css 初始化
html,body,h1,h2,h3,h4,h5,h6,div,dl,dt,dd,ul,ol,li,p,blockquote,pre,hr,figure,table,caption,th,td,for ...
- DDD(领域驱动设计)理论结合实践
DDD(领域驱动设计)理论结合实践 写在前面 插一句:本人超爱落网-<平凡的世界>这一期,分享给大家. 阅读目录: 关于DDD 前期分析 框架搭建 代码实现 开源-发布 后记 第一次听 ...
- 一键部署mono 免费空间
一键部署mono 免费空间支持c# 再也不担心伙食费换空间了 一直以来 部署mono 都是很头疼的事情 因为是我在是不熟悉非win环境,今天偶然发现这个项目,挺好的,分享下 https://githu ...