2018-2-11 15:42:17 [显示全部楼层]
12815浏览
查看: 12815|回复: 5

RGB marix led点阵屏--蓝牙音乐频谱播放器

[复制链接]

黑色点阵金属边框的深沉feel,幽兰迷离等效  曲风自然跳跃的 new york city。
这一切的全部归结于RGB matrix led点阵屏
RGB marix led点阵屏--蓝牙音乐频谱播放器图1
准备工作:
IDC转接线                                                                x1
电源连接线                                                                x1
Arduino uno                                  x132x16
RGB LED Matrix - 6mm pitch 点阵屏        x1
接口说明:
RGB marix led点阵屏--蓝牙音乐频谱播放器图2
测试电路连线:
RGB marix led点阵屏--蓝牙音乐频谱播放器图5
示例代码:
  1. // scrolltext demo for Adafruit RGBmatrixPanel library.
  2. // Demonstrates double-buffered animation on our 16x32 RGB LED matrix:
  3. // <a href="http://www.adafruit.com/products/420" target="_blank">http://www.adafruit.com/products/420</a>
  4. // Written by Limor Fried/Ladyada & Phil Burgess/PaintYourDragon
  5. // for Adafruit Industries.
  6. // BSD license, all text above must be included in any redistribution.
  7. #include <Adafruit_GFX.h>   // Core graphics library
  8. #include <RGBmatrixPanel.h> // Hardware-specific library
  9. // Similar to F(), but for PROGMEM string pointers rather than literals
  10. #define F2(progmem_ptr) (const __FlashStringHelper *)progmem_ptr
  11. #define CLK 8  // MUST be on PORTB! (Use pin 11 on Mega)
  12. #define LAT A3
  13. #define OE  9
  14. #define A   A0
  15. #define B   A1
  16. #define C   A2
  17. // Last parameter = 'true' enables double-buffering, for flicker-free,
  18. // buttery smooth animation.  Note that NOTHING WILL SHOW ON THE DISPLAY
  19. // until the first call to swapBuffers().  This is normal.
  20. RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, true);
  21. // Double-buffered mode consumes nearly all the RAM available on the
  22. // Arduino Uno -- only a handful of free bytes remain.  Even the
  23. // following string needs to go in PROGMEM:
  24. const char str[] PROGMEM = "DFRobot";
  25. int    textX   = matrix.width(),
  26.        textMin = sizeof(str) * -12,
  27.        hue     = 0;
  28. int8_t ball[3][4] = {
  29.   {  3,  0,  1,  1 }, // Initial X,Y pos & velocity for 3 bouncy balls
  30.   { 17, 15,  1, -1 },
  31.   { 27,  4, -1,  1 }
  32. };
  33. static const uint16_t PROGMEM ballcolor[3] = {
  34.   0x0080, // Green=1
  35.   0x0002, // Blue=1
  36.   0x1000  // Red=1
  37. };
  38. void setup() {
  39.   matrix.begin();
  40.   matrix.setTextWrap(false); // Allow text to run off right edge
  41.   matrix.setTextSize(2);
  42. }
  43. void loop() {
  44.   byte i;
  45.   // Clear background
  46.   matrix.fillScreen(0);
  47.   // Bounce three balls around
  48.   for(i=0; i<3; i++) {
  49.     // Draw 'ball'
  50.     matrix.fillCircle(ball
  51. [0], ball
  52. [1], 5, pgm_read_word(&ballcolor
  53. ));
  54.     // Update X, Y position
  55.     ball
  56. [0] += ball
  57. [2];
  58.     ball
  59. [1] += ball
  60. [3];
  61.     // Bounce off edges
  62.     if((ball
  63. [0] == 0) || (ball
  64. [0] == (matrix.width() - 1)))
  65.       ball
  66. [2] *= -1;
  67.     if((ball
  68. [1] == 0) || (ball
  69. [1] == (matrix.height() - 1)))
  70.       ball
  71. [3] *= -1;
  72.   }
  73.   // Draw big scrolly text on top
  74.   matrix.setTextColor(matrix.ColorHSV(hue, 255, 255, true));
  75.   matrix.setCursor(textX, 1);
  76.   matrix.print(F2(str));
  77.   // Move text left (w/wrap), increase hue
  78.   if((--textX) < textMin) textX = matrix.width();
  79.   hue += 7;
  80.   if(hue >= 1536) hue -= 1536;
  81.   // Update display
  82.   matrix.swapBuffers(false);
  83. }
复制代码

演示效果:
RGB marix led点阵屏--蓝牙音乐频谱播放器图3
32x32 RGB LED Matrix - 4mm pitch 点阵屏            
RGB marix led点阵屏--蓝牙音乐频谱播放器图4
线路连接:
RGB marix led点阵屏--蓝牙音乐频谱播放器图6
演示效果:
RGB marix led点阵屏--蓝牙音乐频谱播放器图7

Rgb matrix panel库函数:
RGBmatrixPannel::color333(uint8_t r, uint8_t  g, uint8_t b)
//promote 3/3/3 rgb to adafruit_gfx 5/6/5 3/3/3颜色比例转换为5/6/5
RRRGGGBBB->RRRrrGGGgggBBBbb
类似color444(uint8_t r, uint8_t  g, uint8_t b)
     color888(uint8_t r, uint8_t  g, uint8_t b)
选用color888 r/g/b828次方等于256,方便对照rgb颜色对照表;
RGB marix led点阵屏--蓝牙音乐频谱播放器图8


Fillscreenuint16_t c) 填充屏幕c
Colorhsv rgbhsv颜色空间的理解:
RGB marix led点阵屏--蓝牙音乐频谱播放器图9
Drawpixelint16_t x, int16_t y, uint16_t c) 绘制像素点
由于需要在arduino上进行声音处理,就需要FFT变换(快速傅里叶变换)
.  傅里叶变化概念
.  复数的概念
.  欧拉公式
好像记忆里大学的信号的数据分析原理以及通讯原理讲过;
RGB marix led点阵屏--蓝牙音乐频谱播放器图10
蓝牙音频的接口电路示意图如上;
RGB marix led点阵屏--蓝牙音乐频谱播放器图11
我们还用到arduino mega2560进行控制和fft转换
接线细节如下:
RGB marix led点阵屏--蓝牙音乐频谱播放器图12RGB marix led点阵屏--蓝牙音乐频谱播放器图13RGB marix led点阵屏--蓝牙音乐频谱播放器图14

xyywo  学徒

发表于 2018-3-14 21:40:10

大神,你这个蓝牙模块接线图有没有详细的呀,代码有没有分享的,求分享邮箱xyywo@163.com
回复

使用道具 举报

艾森豪威尔  见习技师

发表于 2018-9-10 10:00:19

我想问如果想在点阵屏上想显示相应的字,并且移动该如何做。一个一个点亮吗?还是有什么新的方法。求详细解析。邮箱1572662276@qq.com
回复

使用道具 举报

艾森豪威尔  见习技师

发表于 2018-9-10 10:00:48

艾森豪威尔 发表于 2018-9-10 10:00
我想问如果想在点阵屏上想显示相应的字,并且移动该如何做。一个一个点亮吗?还是有什么新的方法。求详细解 ...

这个代码我不怎么能看懂
回复

使用道具 举报

gada888  版主

发表于 2018-10-9 10:48:56

这个点阵屏连线满复杂
回复

使用道具 举报

zhuxhui  见习技师

发表于 2020-9-22 22:00:17

还用到了IO传感器扩展板吗?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

为本项目制作心愿单
购买心愿单
心愿单 编辑
[[wsData.name]]

硬件清单

  • [[d.name]]
btnicon
我也要做!
点击进入购买页面
关于楼主
上海智位机器人股份有限公司 沪ICP备09038501号-4

© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed

mail