查看“Light Indicator”的源代码
←
Light Indicator
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{Language|Light Indicator}} {| style="width: 800px;" |- | ==Objective== Here we make a simple light indicator, which classify light value in three levels—green, blue and red. ==Principle== ==Equipment== {|class="wikitable" |- |Module||Number||Function |- |[[Microduino-CoreUSB]]||1||Core board |- |S[[Microduino-Sensorhub]]||1||Sensor pinboard |- |[[Microduino-Light]]||1||light-sensitive sensor |- |[[Microduino-Colorled]]||1||Colored led light |- | [[Microduino-BM]]||1||Battery management |} [[File:light_indicator.jpg|600px|center|thumb]] ==Hardware Buildup== *Setup 1:Connect CoreUSB to your PC, open program examples, select the right board (Microduino-CoreUSB) and download program through serial port. [https://github.com/Microduino/Microduino_Tutorials/blob/master/MCookie_Tutorial/light_led/light_led.ino light_led] *Setup2:Connect the light-sensitive resistor to A0 pin of Sensorhub and the colored LED light to D6 pin. [[file:Microduino-sensorhub_rule.JPG|thumb|800px|center]] [[file: light_indicator _A0_6.JPG|thumb|800px|center]] *Setup5:Stack CoreUSB, Sensorhu and BM. [[file: light_indicator_module.JPG|thumb|800px|center]] *Setup6:Connect the battery to BM. [[file: light_indicator _bm.JPG|thumb|800px|center]] ==Software Debuggin== Code description: One part to acquire sensor values and the other part to control LED brightness and color change according the values. *Sensor pin description <source lang="cpp"> #define PIN 6 Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, PIN, NEO_GRB + NEO_KHZ800); #define Light_PIN A0 </source> *Light intensity pre-set value and the light can be divided into three levels. <source lang="cpp"> #define Light_value1 400 #define Light_value2 800 </source> *Light detection <source lang="cpp"> sensorValue = analogRead(Light_PIN); </source> *The colored LED will adjust color and brightness according to light intensity. <source lang="cpp"> if (sensorValue < Light_value1) colorWipe(strip.Color(0, map(sensorValue, 10, 400, 0, 255), 0)); else if (sensorValue >= Light_value1 && sensorValue < Light_value2) colorWipe(strip.Color(0, 0, map(sensorValue, 400, 800, 0, 255))); else if (Light_value2 >= 800) colorWipe(strip.Color(map(sensorValue, 800, 960, 0, 255), 0, 0)); </source> ==Result== Change light intensity from weak to strong, you can see gree, blue and red in order. ==Video== |}
该页面使用的模板:
模板:Language
(
查看源代码
)
模板:Nmbox
(
查看源代码
)
返回至
Light Indicator
。
导航菜单
个人工具
创建账户
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
Welcome
首页
创客大赛
大赛详情
3D打印
安装月球车
图形化编程
操控月球车
升级月球车
编程工具下载
软件下载
Arduino
Processing
Mixly
Scratch
模块套件
Microduino 102
mCookie 102
mCookie 202
mCookie 302
IBC
其他
应用套件
四轴飞行器
平衡车
小车CUBE
音乐播放器
刷卡音乐播放器
wifi气象站
彩虹音乐触摸灯
分贝检测仪
迎门汇报
LED点阵时钟
LED点阵屏幕
硬件
mCookie
Sensor
Microduino
MicroWrt
MicroNux
MicroRobot-Core
MicroRobot-CoreESP
ideaBoard
ideaBox
MicroMV
MicroAI
帮助
常见问题
帮助
工具
链入页面
相关更改
特殊页面
页面信息