|
|
(未显示同一用户的3个中间版本) |
第1行: |
第1行: |
| | | |
− | [[文件:嘘寒问暖_ico.png|400px|缩略图|右 ]]<br /> | + | [[文件:XXXX_ico.png|400px|缩略图|右 ]]<br /> |
| | | |
| == 概述 == | | == 概述 == |
− | 本作品可实现自动检测水杯温度,并通过RGB灯的颜色直观反映水杯温度的高低。使用时先根据制作说明
| + | 简要功能说明 |
− | 将作品组装完整,然后接上电源(9V电池或USB供电),打开主控板开关,将水杯放置在作品中间的温度传
| |
− | 感器探头上方即可。当温度高时,RGB灯亮红色;温度低时,亮蓝色;温度适中时,亮绿色。DIY动手组
| |
− | 装,锻炼动手能力,了解智能创意电子套件的使用,激发创新思维,增加学习乐趣。
| |
| | | |
| == 使用教程 == | | == 使用教程 == |
− | 当水杯放置在色温杯垫上,温度感应探头测量水杯温度,并通过灯颜色反应水杯温度。当水温43℃以上,全红;当水温在43~33℃之间,红绿渐变色;当水温33~18℃之间,绿蓝渐变色;当水温18℃以下,全蓝;
| + | 使用说明包含程序控制流程 |
| <br/> | | <br/> |
| === <font size=3px>组装说明</font> === | | === <font size=3px>组装说明</font> === |
− | [http://wiki.labplus.cn/images/9/93/%E5%98%98%E5%AF%92%E9%97%AE%E6%9A%96%E8%A3%85%E9%85%8D.pdf 嘘寒问暖装配说明下载 ] | + | :{|style="background-color:#FCF8E3;color:#8A6D3B;" |
− | [[File:嘘寒问暖 装配说明.png]] | + | |-style="vertical-align:center;" |
| + | |[[File:点击下载.png|30px|center]] |
| + | | |
| + | #[[:File:XXXX装配.pdf |XXXX装配下载]] |
| + | # |
| + | |} |
| + | |
| + | <br/> |
| + | [[File:XXXX_装配.png]] |
| <br/> | | <br/> |
| <br/> | | <br/> |
第21行: |
第26行: |
| !模块名称||数量 | | !模块名称||数量 |
| |- | | |- |
− | |w1主控板||x1 | + | |||x1 |
| |- | | |- |
− | |温度传感器||x1 | + | |||x1 |
− | |-
| |
− | |RGB-LED灯|| x4
| |
| |} | | |} |
| === <font size=3px>电子模块连接说明</font> === | | === <font size=3px>电子模块连接说明</font> === |
第36行: |
第39行: |
| | 温度传感器模块 || W1-I2C接口|| | | | 温度传感器模块 || W1-I2C接口|| |
| |- | | |- |
− | | RGB—LED模块x4 ||W1-3/11接口 ||4个模块串联,注意信号方向,输出接口连接至下模块输入接口 | + | | RGB—LED模块x4 ||W1-3/11接口 || |
| |- | | |- |
| |} | | |} |
− | === <font size=3px>Arduino程序</font> === | + | === <font size=3px>Arduino程序/图形化程序</font> === |
− | [[文件:http://wiki.labplus.cn/images/4/4a/M0002_Tcup_SW_V1_4_Release.rar|嘘寒问暖Arduino程序包下载]] | + | {|style="background-color:#FCF8E3;color:#8A6D3B;" |
| + | |-style="vertical-align:center;" |
| + | |[[File:点击下载.png|30px|center]] |
| + | |[[:File:XXXX_Release.rar]] |
| + | |} |
| <pre style="color:blue"> | | <pre style="color:blue"> |
− | /**************************************************************************
| |
− | Copyright (C), 2017- ,
| |
− | File name: 色温杯垫
| |
− | Author: Tangliufeng Version: v1.4 Date:
| |
− | Description:
| |
− | Others:
| |
− | Function List:
| |
− | 1.
| |
− | 2.
| |
− | History:
| |
− |
| |
− | 1. Date: 2017/10/10 Author: tangliufeng
| |
− | Modification: 更换新RGB模块
| |
− | 2. ...
| |
− | ****************************************************************************/
| |
− |
| |
− | #include <Wire.h>
| |
− | #include <avr/wdt.h>
| |
− | #include "TemperatureNTC.h"
| |
− | #include "Adafruit_NeoPixel.h"
| |
− |
| |
− |
| |
− | #define PIXEL_PIN 3
| |
− | #define PIXEL_COUNT 4
| |
− |
| |
− |
| |
− | int Temperature;
| |
− | uint8_t _R, _G, _B;
| |
− | int i = 1;
| |
− |
| |
− | uint8_t TEMP;
| |
− | uint8_t humidity;
| |
− | uint8_t SW;
| |
− |
| |
− | long time_out;
| |
− | long time_out1;
| |
− | long time_out2;
| |
− |
| |
− | uint16_t h, color1;
| |
− | float s, v;
| |
− |
| |
− | Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, NEO_GRB + NEO_KHZ800);
| |
− |
| |
− | void setup()
| |
− | {
| |
− | s = 1.0;
| |
− | v = 0.5;
| |
− | h = 0;
| |
− |
| |
− | Serial.begin(9600);
| |
− | strip.setBrightness(50);
| |
− | strip.begin();
| |
− | start();
| |
− | strip.clear();
| |
− | strip.show();
| |
− |
| |
− | }
| |
− |
| |
− | void loop()
| |
− | {
| |
− | Temperature = readTemperatureNTC(A2);
| |
− | Serial.print("Temper:");
| |
− | Serial.println(Temperature);
| |
− | if (Temperature >= 44) //大于44度变红色
| |
− | {
| |
− | color1 = 0;
| |
− | }
| |
− | else if (Temperature <= 33)
| |
− | {
| |
− | color1 = map(Temperature, 18, 33, 240, 200);; //18~33度 变蓝色
| |
− | }
| |
− | else
| |
− | {
| |
− | color1 = map(Temperature, 35, 43, 120, 0); //35~43度 变红色
| |
− | }
| |
− |
| |
− | HSV2RGB(color1, s, v, _R, _G, _B);
| |
− |
| |
− | for (uint8_t i = 0; i < PIXEL_COUNT; i++)
| |
− | {
| |
− | strip.setPixelColor(i, _R, _G, _B);
| |
− | }
| |
− | strip.show();
| |
− |
| |
− |
| |
− | }
| |
− |
| |
− | void start()
| |
− | {
| |
− | char x = 3;
| |
− | while (x--)
| |
− | {
| |
− | for (uint8_t i = 0; i < PIXEL_COUNT; i++)
| |
− | {
| |
− | strip.setPixelColor(i, 16, 0, 0);
| |
− | }
| |
− | strip.show();
| |
− | delay(300);
| |
− | for (uint8_t i = 0; i < PIXEL_COUNT; i++)
| |
− | {
| |
− | strip.setPixelColor(i, 0, 16, 0);
| |
− | }
| |
− | strip.show();
| |
− | delay(300);
| |
− | for (uint8_t i = 0; i < PIXEL_COUNT; i++)
| |
− | {
| |
− | strip.setPixelColor(i, 0, 0, 16);
| |
− | }
| |
− | strip.show();
| |
− | delay(300);
| |
− | }
| |
− | }
| |
− |
| |
− | void HSV2RGB(uint16_t H, float S, float V, uint8_t &R, uint8_t &G, uint8_t &B)
| |
− | {
| |
− | uint8_t hi;
| |
− | float f, p, q, t;
| |
− | hi = (uint8_t)(H / 60);
| |
− | f = (float)H / 60 - hi;
| |
− | p = V * (1 - S);
| |
− | q = V * (1 - f * S);
| |
− | t = V * (1 - (1 - f) * S);
| |
− | switch (hi)
| |
− | {
| |
− | //0: {r,g,b} = {v,t,p}
| |
− | case 0:
| |
− | R = V * 255;
| |
− | G = t * 255;
| |
− | B = p * 255;
| |
− | break;
| |
− | //1: {r,g,b} = {q,v,p}
| |
− | case 1:
| |
− | R = q * 255;
| |
− | G = V * 255;
| |
− | B = p * 255;
| |
− | break;
| |
− | //2: {r,g,b} = {p,v,t}
| |
− | case 2:
| |
− | R = p * 255;
| |
− | G = V * 255;
| |
− | B = t * 255;
| |
− | break;
| |
− | //3: {r,g,b} = {p,q,v}
| |
− | case 3:
| |
− | R = p * 255;
| |
− | G = q * 255;
| |
− | B = V * 255;
| |
− | break;
| |
− | //4: {r,g,b} = {t,p,v}
| |
− | case 4:
| |
− | R = t * 255;
| |
− | G = p * 255;
| |
− | B = V * 255;
| |
− | break;
| |
− | //5: {r,g,b} = {v,p,q}
| |
− | case 5:
| |
− | R = V * 255;
| |
− | G = p * 255;
| |
− | B = q * 255;
| |
− | break;
| |
− | default:
| |
− | break;
| |
− | }
| |
− | }
| |
− |
| |
− |
| |
| </pre> | | </pre> |
| | | |