本网页已闲置超过3分钟,按键盘任意键或点击空白处,即可回到网页
最热资讯


亲,“电路城”已合并升级到更全、更大、更强的「新与非网」。点击查看「新与非网」
作为一个狂热的LED电路爱好者, 没有 LED 一切都很无聊,所以让我们用它打造一座城市吧!
基本理念:
所以我们用纸板构建了一个城市模式,然后用大量的 RGB LED 照亮它,并使用 LM35 温度传感器让颜色的温度根据室温变化。
补给品
1. WS2812b RGB LED(新像素)。
2. Arduino Uno/nano 或任何其他可用的 arduino。
3.一些电线。
4. 纸板。
5. 纸
6. 某种油漆。
7. LM35 温度传感器。
8. 塑料、粘土或有弹性的材料。
9. 棉花(来自药房)。
10.铝箔。
工具:
1.热胶枪。
2. 烙铁(带一些焊锡丝)。
3. 用刀或剪刀剪纸板和纸
4. 标尺。
第 1 步:绘图
首先,我们画了一堆草图,然后听 Bee Gees - Stayin' Alive 连续 8 小时寻找灵感。最后我们想出了一些东西......
第 2 步:中心大楼
我们决定将主楼设计成八角形。我们剪下纸板,然后将其弯曲并将 LED 灯条粘在上面。我们给它涂漆,然后用热胶填充窗孔,使其具有模糊效果。然后把它放在城市的中心。
第 3 步:构建树木
四根电线从树根里穿出,建议对他们进行颜色编码, 黑色- GND; 红色 - 5v; 黄色- Din; 蓝色 - DO。
第 4 步:其他建筑物
然后我们开始建造其他建筑。它们都是相同的,但尺寸不同。我们剪下来,给它们上漆,然后像以前一样制作窗户。我们在纸板的底部放置了 LED,并用铝箔制作了屋顶。铝箔有助于反射光线。
第 5 步:公园(主要是草地)
我们用这种有弹性的东西制作了一些草,以赋予它 3D 的感觉。哦,我们还用淡蓝色和白色的颜料画了这条河。我们使用丙烯酸涂料,但我相信其他类型的涂料也可以使用。
第 6 步:接线
只有在一切就绪后才能执行此步骤。将所有 GND 和 5V 电线连接在一起并连接菊花链 LED。然后将菊花链主输入连接到 Arduino 数字引脚 5。将 GND 和 5v 连接到其引脚。强烈建议使用外部电源。只需使用 5V 外部电源并将电源 GND 连接到 Arduino GND,将电源 5V 连接到 Arduino 5V。接线可能看起来像我的情况一样凌乱,但它实际运行的很好。
第 7 步:绘制停车场
绘制效果如下图.
第 8 步:上传Arduino 代码
#include #define NUM_LEDS 100 #define DATA_PIN 5 #define CLOCK_PIN 8 int val; int tempPin = 3; int BT1 = 0; int BT2 = 1; int BT3 = 2; int BT4 = 3; int BT5 = 4; int BT6 = 5; int BT7 = 6; int BT8 = 7; int WT1 = 28; int WT2 = 29; int WT3 = 30; int WT4 = 31; int TrBl = 0; CRGB leds[NUM_LEDS]; void setup() { FastLED.addLeds(leds, NUM_LEDS); Serial.begin(9600); } void loop() { val = analogRead(tempPin); float mv = ( val/1024.0)*5000; float cel = mv/10; Serial.print(cel); Serial.print(" "); Serial.print(TrBl); Serial.println(); TrBl = map(cel, 25, -10, 0, 255); if (TrBl < 0) { TrBl = 0; } if (TrBl > 255) { (TrBl = 255); } leds[BT1] = CRGB(0, 255, TrBl); leds[BT2] = CRGB(0, 255, TrBl); leds[BT3] = CRGB(0, 255, TrBl); leds[BT4] = CRGB(0, 255, TrBl); leds[BT5] = CRGB(0, 255, TrBl); leds[BT6] = CRGB(0, 255, TrBl); leds[BT7] = CRGB(0, 255, TrBl); leds[BT8] = CRGB(0, 255, TrBl); leds[8] = CRGB(200, 255, TrBl); leds[9] = CRGB(200, 255, TrBl); leds[10] = CRGB(200, 255, TrBl); leds[11] = CRGB(200, 255, TrBl); leds[12] = CRGB(200, 255, TrBl); leds[13] = CRGB(200, 255, TrBl); leds[14] = CRGB(200, 255, TrBl); leds[15] = CRGB(200, 255, TrBl); leds[16] = CRGB(200, 255, TrBl); leds[17] = CRGB(200, 255, TrBl); leds[18] = CRGB(200, 255, TrBl); leds[19] = CRGB(200, 255, TrBl); leds[20] = CRGB(200, 255, TrBl); leds[21] = CRGB(200, 255, TrBl); leds[22] = CRGB(200, 255, TrBl); leds[23] = CRGB(200, 255, TrBl); leds[24] = CRGB(200, 255, TrBl); leds[25] = CRGB(200, 255, TrBl); leds[26] = CRGB(200, 255, TrBl); leds[27] = CRGB(200, 255, TrBl); leds[WT1] = CRGB(0, 255, TrBl); leds[WT2] = CRGB(0, 255, TrBl); leds[WT3] = CRGB(0, 255, TrBl); leds[WT4] = CRGB(0, 255, TrBl); leds[32] = CRGB(200, 255, TrBl); leds[33] = CRGB(200, 255, TrBl); leds[34] = CRGB(200, 255, TrBl); leds[35] = CRGB(200, 255, TrBl); leds[36] = CRGB(200, 255, TrBl); leds[37] = CRGB(200, 255, TrBl); leds[38] = CRGB(200, 255, TrBl); leds[39] = CRGB(200, 255, TrBl); leds[40] = CRGB(200, 255, TrBl); leds[41] = CRGB(200, 255, TrBl); leds[42] = CRGB(200, 255, TrBl); leds[43] = CRGB(200, 255, TrBl); leds[44] = CRGB(200, 255, TrBl); leds[45] = CRGB(200, 255, TrBl); leds[46] = CRGB(200, 255, TrBl); leds[47] = CRGB(200, 255, TrBl); leds[48] = CRGB(200, 255, TrBl); leds[49] = CRGB(200, 255, TrBl); leds[50] = CRGB(200, 255, TrBl); leds[51] = CRGB(200, 255, TrBl); leds[52] = CRGB(200, 255, TrBl); leds[53] = CRGB(200, 255, TrBl); leds[54] = CRGB(200, 255, TrBl); leds[55] = CRGB(200, 255, TrBl); leds[56] = CRGB(200, 255, TrBl); leds[57] = CRGB(200, 255, TrBl); leds[58] = CRGB(200, 255, TrBl); leds[59] = CRGB(200, 255, TrBl); leds[60] = CRGB(200, 255, TrBl); leds[61] = CRGB(200, 255, TrBl); leds[62] = CRGB(200, 255, TrBl); leds[63] = CRGB(200, 255, TrBl); leds[64] = CRGB(200, 255, TrBl); FastLED.show(); delay(50); //this code changes its color temperature according to room temperature. it adds more blue the lower the temperature gets. } |
第 9 步:Arduino 库
从以下位置下载 Arduino FastLED.h 库:https://github.com/FastLED/FastLED
拆解: 130美元的声控家用设备Amazon Tap蓝牙音箱
2016-06-29
面临制造业流失,科技巨头跑路,创业公司倒闭的深圳,已不再是科技创业者的天堂?
2017-10-17
物联网连接技术:cellular还是LPWAN?
2018-11-16
物联网安全和Linux:为什么IncludeOS有其优势
2018-11-14
遥感技术的演变:实现物联网的承诺
2018-11-19
如何将按钮与 Arduino 连接起?
2021-07-13
基于树莓派和Arduino打造的PLC EtherCAT电路设计
2020-02-25
2019年你最值得入手的5款开发板
2019-08-21
入门指南:TFT彩色显示屏,带Arduino和ESP8266
2020-04-23
Arduino最小系统板设计PCB板及原理图
2020-01-17
讨论