10880| 5
|
DIY七夕情人节礼物—爱心吊坠 |
本帖最后由 源代码 于 2018-8-16 03:38 编辑 七夕情人节,是中国传统节日。相传,七夕节这天,王母娘娘准许牛郎织女通过喜鹊搭建的鹊桥来相会。牛郎织女一年就只有七夕这天能够相会,象征着爱情的坚贞不渝。七夕积淀了太多的感情因素和人们对生活诠释,所以难以放弃。纵观“七夕”在我国的发展史,凡是动乱时期它是最容易被人们淡化的,凡是安定时期又是最让人挂牵的。现在又到了一个重新挂牵“七夕”的时期 了,所以准备动手做个爱心吊坠与女友相会。 话不多说,直接上教程! 一,材料准备 二,制作步骤 1.由于7219点阵模块太厚,所以必须对点阵模块减厚处理,去掉插针管脚直接焊接,这样厚度至少减薄一半,有利于降低吊坠整体厚度。 2.去除Sparrow控制器上的锂电池插座,电池直接焊接在控制板上。 3.将点阵触点上焊接上导线,将7219点阵上的DIN、CS、CLK引脚分别焊接在Sparrow控制器的6、8、9引脚上。 4.将点阵屏用少量热熔胶固定在Sparrow控制板上,再把吊坠扣安装在3D打印的外壳框上。 5.焊接3.7v锂电池在Sparrow控制板上,并用热熔胶固定。用海绵胶带将Sparrow控制器整个主板做防漏处理,这一步的目的是为了防止UV胶向外溢出或胶进入开关及充电插口。 6.将Sparrow控制器安装在吊坠框内,并用少量热熔胶固定。 7.准备两个杯子分别以1:2比例放入绿色、蓝色色精再加入UV胶,并朝一个方向搅拌至无颗粒状,再将两种颜色UV胶混合。 8.将吊坠框尽量放在水平的桌面上,可以借助水平仪调平,超一边缓慢将UV胶倒入到主板与框的缝隙填充,倒入过快容易产生气泡。浇筑后用紫外线灯照射10分钟即可固化,也可以晴天放在太阳下照射20分钟。 9.如你所见,由于我的开关没有密封好,造成UV胶流入内部固化报废了,只能重新焊接换了一个拨动开关代替,朋友们使用UV胶的时候要特别注意。 三,上传程序。 [mw_shl_code=cpp,true]int dataIn = 6; int load = 8; int clock = 9; int intensity = 0; int maxInUse = 1; int e = 0; byte max7219_reg_noop = 0x00; byte max7219_reg_digit0 = 0x01; byte max7219_reg_digit1 = 0x02; byte max7219_reg_digit2 = 0x03; byte max7219_reg_digit3 = 0x04; byte max7219_reg_digit4 = 0x05; byte max7219_reg_digit5 = 0x06; byte max7219_reg_digit6 = 0x07; byte max7219_reg_digit7 = 0x08; byte max7219_reg_decodeMode = 0x09; byte max7219_reg_intensity = 0x0a; byte max7219_reg_scanLimit = 0x0b; byte max7219_reg_shutdown = 0x0c; byte max7219_reg_displayTest = 0x0f; void putByte(byte data) { byte i = 8; byte mask; while(i > 0) { mask = 0x01 << (i - 1); digitalWrite( clock, LOW); if (data & mask){ // choose bit digitalWrite(dataIn, HIGH); }else{ digitalWrite(dataIn, LOW); } digitalWrite(clock, HIGH); --i; // move to lesser bit } } void maxSingle( byte reg, byte col) { digitalWrite(load, LOW); putByte(reg); putByte(col); digitalWrite(load, LOW); digitalWrite(load,HIGH); } void maxAll (byte reg, byte col) { int c = 0; digitalWrite(load, LOW); for ( c =1; c<= maxInUse; c++) { putByte(reg); putByte(col); } digitalWrite(load, LOW); digitalWrite(load,HIGH); } void maxOne(byte maxNr, byte reg, byte col) { int c = 0; digitalWrite(load, LOW); for ( c = maxInUse; c > maxNr; c--) { putByte(0); putByte(0); } putByte(reg); putByte(col); for ( c =maxNr-1; c >= 1; c--) { putByte(0); putByte(0); } digitalWrite(load, LOW); digitalWrite(load,HIGH); } void setup () { pinMode(dataIn, OUTPUT); pinMode(clock, OUTPUT); pinMode(load, OUTPUT); maxAll(max7219_reg_scanLimit, 0x07); maxAll(max7219_reg_decodeMode, 0x00); maxAll(max7219_reg_shutdown, 0x01); maxAll(max7219_reg_displayTest, 0x00); for (e=1; e<=8; e++) { maxAll(e,0); } maxAll(max7219_reg_intensity, 0x08 & 0x0f); } int row=0, col=0; #define rowMax 27 #define colMax 8 int valueMask[rowMax][colMax]={ {B00000000,B01100110,B11111111,B11111111,B11111111,B01111110,B00111100,B00011000}, {B00000000,B00000000,B00100100,B01111110,B01111110,B00111100,B00011000,B00000000}, {B00000000,B01100110,B11111111,B11111111,B11111111,B01111110,B00111100,B00011000}, {B00000000,B00000000,B00100100,B01111110,B01111110,B00111100,B00011000,B00000000}, {B00000000,B01100110,B11111111,B11111111,B11111111,B01111110,B00111100,B00011000}, {B00000000,B00000000,B00100100,B01111110,B01111110,B00111100,B00011000,B00000000}, {B00000000,B01100110,B11111111,B11111111,B11111111,B01111110,B00111100,B00011000}, {B00010000,B10010000,B10110000,B10110000,B11110001,B11111001,B11111011,B11111111}, {B00001000,B01001100,B01001101,B01101101,B01101101,B01101101,B01111101,B11111111}, {B00000001,B00000101,B00100101,B00110101,B10110101,B10110101,B11110111,B11111111}, {B10000000,B11000000,B11001000,B11001000,B11001000,B11101010,B11111010,B11111111}, {B00000000, B00111100, B01111110, B11011011, B11011011, B01111110, B00100100, B11000011}, {B00111100, B01111110, B11011011, B11011011, B01111110, B00100100, B00100100, B00100100}, {B00000000, B00111100, B01111110, B11011011, B11011011, B01111110, B00100100, B11000011}, {B00111100, B01111110, B11011011, B11011011, B01111110, B00100100, B00100100, B00100100}, {B00100100, B00100100, B01111110, B11011011, B11111111, B11111111, B10100101, B00100100}, {B00100100, B10100101, B11111111, B11011011, B11111111, B01111110, B00100100, B01000010}, {B00100100, B00100100, B01111110, B11011011, B11111111, B11111111, B10100101, B00100100}, {B00100100, B10100101, B11111111, B11011011, B11111111, B01111110, B00100100, B01000010}, {B01100110,B11111111,B11111111,B11111111,B01111110,B00111100,B00011000,B00000000}, {B00001110,B00011111,B00111111,B01111110,B01111110,B00111111,B00011111,B00001110}, {B00000000,B00011000,B00111100,B01111110,B11111111,B11111111,B11111111,B01100110}, {B01110000,B11111000,B11111100,B01111110,B01111110,B11111100,B11111000,B01110000}, {B01100110,B11111111,B11111111,B11111111,B01111110,B00111100,B00011000,B00000000}, {B00000000,B00001100,B00011110,B00111100,B00111100,B00011110,B00001100,B00000000}, {B00000000,B00011000,B00111100,B01111110,B11111111,B11111111,B11100111,B01100110}, {B00000000,B00110000,B01111000,B00111100,B00111100,B01111000,B00110000,B00000000} }; void loop () { for(row=0;row<rowMax;row++) { for(col=0;col<colMax;col++) { maxSingle(col+1,valueMask[row][col]); } if(row<(rowMax-8)) { delay(250); } else { delay(120); } if(row % 2 == 0) { digitalWrite(13, LOW); } else { digitalWrite(13, HIGH); } } }[/mw_shl_code] 最后准备一条吊坠挂件绳打结连接在点阵吊坠扣上,一个跳动的爱心动画吊坠就做好了。 【本帖仅限DFRobot社区论坛,未经许可,不得转载!】 -----------------------END----------------------- 题外 目前Sparrow控制器我们正在微信群众筹,对这款控制器感兴趣的朋友可以扫码进群了解详情,感谢大家支持! |
167.9 KB, 下载次数: 2117
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed