查看“Thermo Cup”的源代码
←
Thermo Cup
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{Language| Thermo Cup}} {| style="width: 800px;" |- | ==Objective== This cup can "sense" water temperature and present light based on program setting with different color. [[File: Temp_Cap-cool.jpg|600px|center]] ==Principle== Temperature and humidity sensor detects environment temperature and humidity and make light present different color in different sections. [[File: Temp_Cap-sch.jpg|600px|center]] ==Equipment== {|class="wikitable" |- |Module||Number||Function |- |[[mCookie-CoreUSB]]||1||Core board |- |[[ mCookie-Hub]]||1||Sensor pin board |- | [[mCookie-BM]]||1||Battery management |- | [[Microduino-Temp&Hum]]||1||Temperature and humidity sensor |- | [[Microduino-Color led]]||1||Colored LED light |} *Other Equipment: **Two cells of battery [[File: Temp_Cap_sch.jpg|600px|center]] ==Load the Code== *Setup 1:Connect CoreUSB and PC/MAC with a USB cable and open Arduino IDE. [[File:CoreUSB_Ble_pc.jpg|600px|center]] *Setup 2:Click file > Program examples > mCookie >_206_ThermoCup and load the program. [[File: ThermoCup-ino.jpg|600px|center]] *Setup 3:Choose the right board and serial port, download program to CoreUSB. [[File: ThermoCup-upload.jpg|600px|center]] ==Code Debugging== *Calculate temperature and humidity values--"readByAM2321()" function. You can open serial monitor and check the data. <source lang="cpp"> void readByAM2321() { AM2321 am2321; am2321.read(); sensor_tem = am2321.temperature / 10.0; Serial.println(sensor_tem); delay(100); } </source> [[File: ThermoCup-read.jpg|600px|center]] *Define three temperature values and divide the temperature zone into four sections. You can change the values according to personal needs or add more temperature values. <source lang="cpp"> #define temp1 28 #define temp2 30 #define temp3 32 </source> *Based on the definition for relation between light color and temperature, we set four light RGB values for environment temperature higher than temp1, between temp1 and temp2, between temp2 and temp3 and higher than temp3. You can try to change RGB values or add more temperature sections and see changes. " strip.Color(R,G,B)" R, G and B represents three primiary colors. <source lang="cpp"> if (sensor_tem <= temp1) colorSet(strip.Color(0, 255, 0)); else if (sensor_tem > temp1 && sensor_tem <= temp2) colorSet(strip.Color(0, 0, 255)); else if (sensor_tem > temp2 && sensor_tem <= temp3) colorSet(strip.Color(255, 255, 0)); else colorSet(strip.Color(255, 0, 0)); </source> *About RGB. RGB value is method of defining light color. R(Red), G(Green) and B(Blue) are the three primary colors, whose values is 0-225. The value represents color intensity. Three different kinds of light can be superimposed together to form a variety of colors, such as (0, 225), that is green. [[File: ThermoCup_RGB.jpg|600px|center]] ==Hardware Buildup== *Setup 1:Connect the temp.&hum sensor to the IIC pin of Hub and the colored light to A0. [[file: ThermoCup _setup_2.jpg |600px|center]] *Setup 2:Connect the activated battery box with BM module. [[File:CoreUSB_Ble_steup2.jpg|600px|center]] *Setup 3:Stack all modules without fixed order and finish circuit buildup. [[File: ThermoCup_steup3.jpg|600px|center]] ==Result== The sensor detects different temperature data. You can also build a beautiful shell with LEGO. [[File: ThermoCup_legao.jpg|600px|center]] ==Video== |}
该页面使用的模板:
模板:Language
(
查看源代码
)
模板:Nmbox
(
查看源代码
)
返回至
Thermo Cup
。
导航菜单
个人工具
创建账户
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
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
帮助
常见问题
帮助
工具
链入页面
相关更改
特殊页面
页面信息