Arduino 各种模块篇 RGB LED灯
示例代码:
类似与这样的led,共阴rgb led,通过调节不同的亮度,组合成不同的颜色。
示例代码:
/*
作者:极客工坊
时间:2012年12月18日
IDE版本号:1.0.1
发布地址:www.geek-workshop.com
作用:共阳RGB颜色循环
*/ int redPin = ;
int greenPin = ;
int bluePin = ; void setup()
{
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
} void loop()
{
setColor(, , ); // 红色
delay();
setColor(, , ); // 绿色
delay();
setColor(, , ); // 蓝色
delay();
setColor(, , ); // 黄色
delay();
setColor(, , ); // 紫色
delay();
setColor(, , ); // 浅绿色
delay();
} void setColor(int red, int green, int blue)
{
analogWrite(redPin, -red);
analogWrite(greenPin, -green);
analogWrite(bluePin, -blue);
}
简单演示的代码。
可以显示多种颜色。
更多关于此灯的链接:http://www.geek-workshop.com/forum.php?mod=viewthread&tid=2802
Arduino 各种模块篇 RGB LED灯的更多相关文章
- arduino 蓝牙控制RGB LED灯
/* 日期:2016.9.2 功能:arduino 蓝牙控制RGB LED灯 元件: 跳线公公头 * 8 rgbled, 220欧电阻 蓝牙模块 接线: 蓝牙模块VCC,GND分别接5V,GND;TX ...
- Arduino 各种模块篇 蓝牙模块 手机蓝牙控制Arduino LED灯
解决方案. 条件: 1.手机android 商店下载 blueTerm 2.向arduino中载入如下代码: char val; ; void setup() { Serial.begin(); pi ...
- 基于arduino UNO R3+ESP8266控制LED灯的开关(无USB转TTL工具实现)
最近由于项目要求,需要开发物联网云平台,而本人对硬件和通信技术一窍不通,故而选择arduino这一简单单片机来实现学习掌握基础的硬件和通信技术. 下面就是本人通过查阅大佬资料做的一个整合版本的通过手机 ...
- Arduino 各种模块篇 摇杆模块
Arduino的另外几种模块,我们常见的joystick摇杆模块. 用起来很爽,摇杆 有X,Y轴可调 这里有一篇非常想尽的示例代码: http://www.geek-workshop.com/foru ...
- Arduino系列之pwm控制LED灯(呼吸灯)
下面我将写出最简单控制呼吸灯的方法 void setup() // { pinMode(12,OUTPUT); ...
- Arduino 各种模块篇 粉尘传感器 dust sensor 空气质量检测
Testing a sensor from here. http://www.seeedstudio.com/wiki/Grove_-_Dust_Sensor It's a dust sensor. ...
- Arduino 各种模块篇 光敏感应模块 light sensor
It looks like this one: This one isn't a digital light sensor, so it's very simple. http://www.seeed ...
- Arduino 各种模块篇 motor shield
根据arduino官方网站出的shield, 类似的情况有很多中motor shield 这里测试采用的是http://www.seeedstudio.com/wiki/Motor_Shield_V1 ...
- Arduino 各种模块篇 震动模块 vibrator module
The vibrator I got works at the voltage ranging from 3.3V ~ 5.5V I want to make it vibrate variably. ...
随机推荐
- c#-Artificial Intelligence Class
NET Artificial Intelligence Class http://www.codeproject.com/KB/recipes/aforge_neuro/neuro_src.zip
- ASP.NET Web Service中使用Session 及 Session丢失解决方法 续
原文:ASP.NET Web Service中使用Session 及 Session丢失解决方法 续 1.关于Session丢失问题的说明汇总,参考这里 2.在Web Servcie中使用Sessio ...
- Redis 中文入库成功,读取数据写入文件乱码问题
近期须要用到redis ,可是在编码这个问题上,纠结了非常久. 需求 :每天一个进程将中文文件入库到redis中(不定时更新) ,另外几个进程读取redis中的信息 ,并处理数据结果.使 ...
- 拥抱HTTP2.0时代 - HTTP2.0实现服务器端推送Push功能
在当今的移动互联开发趋势中,nghttp2是一个很值得大家去关注的一个开源项目. 我们在nghttpx模块中实现了HTTP/2服务器推送功能,并且在我们的nghttp2.org网站中启用了该推送功能. ...
- MVC5模板部署到mono
VS2013中的MVC5模板部署到mono上的艰辛历程 2014-10-27 09:30 by FuzhePan, 3954 阅读, 46 评论, 收藏, 编辑 部署环境:CentOS7 + Mono ...
- VS代码生成工具ReSharper发布8.1版本
ReSharper是一个著名的VS代码生成工具,能帮助VS成为一个更佳的IDE.JetBrains公司今天发布了ReSharper最新版本8.1. 本次新版本更新涉及到打印稿.与VS2013集成.代码 ...
- 【转】视差滚动(Parallax Scrolling)效果的原理和实现
原文:http://www.cnblogs.com/JoannaQ/archive/2013/02/08/2909111.html 视差滚动(Parallax Scrolling)是指让多层背景以不同 ...
- Run QTP script wiht host in HPQC
- TodoList开发笔记 – Part Ⅲ
本节开始对TodoList项目的客户端进行开发 一.初步了解JQuery 其实我在学校时有接触过一段时间的Web开发,虽然代码量不多也不复杂,但也已经感受到了各浏览器对Web各项标准的恶意,Web界对 ...
- helloWord
helloWord!!! 在cnblogs安家了