【花雕动手做】有趣好玩的音乐可视化系列项目(30)--P6LED单元板 
  项目程序之二:点亮P6单元板——显示图形与文字 
 
			
			
			- /*
 -   【花雕动手做】有趣好玩的音乐可视化系列项目(30)--P6LED单元板
 -   项目程序之二:点亮P6单元板——显示图形与文字
 - */
 - 
 - #include <Adafruit_GFX.h>   
 - #include <RGBmatrixPanel.h> 
 - 
 - #define CLK 8  
 - #define LAT A3
 - #define OE  9
 - #define A   A0
 - #define B   A1
 - #define C   A2
 - RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, false);
 - 
 - void setup() {
 -   matrix.begin();
 - }
 - 
 - void loop() {
 -   // draw a pixel in solid white
 -   matrix.drawPixel(0, 0, matrix.Color333(7, 7, 7));
 -   delay(500);
 - 
 -   // fix the screen with green
 -   matrix.fillRect(0, 0, 32, 16, matrix.Color333(0, 7, 0));
 -   delay(500);
 - 
 -   // draw a box in yellow
 -   matrix.drawRect(0, 0, 32, 16, matrix.Color333(7, 7, 0));
 -   delay(500);
 - 
 -   // draw an 'X' in red
 -   matrix.drawLine(0, 0, 31, 15, matrix.Color333(7, 0, 0));
 -   matrix.drawLine(31, 0, 0, 15, matrix.Color333(7, 0, 0));
 -   delay(500);
 - 
 -   // draw a blue circle
 -   matrix.drawCircle(7, 7, 7, matrix.Color333(0, 0, 7));
 -   delay(500);
 - 
 -   // fill a violet circle
 -   matrix.fillCircle(23, 7, 7, matrix.Color333(7, 0, 7));
 -   delay(500);
 - 
 -   // fill the screen with 'black'
 -   matrix.fillScreen(matrix.Color333(0, 0, 0));
 - 
 -   // draw some text!
 -   matrix.setCursor(1, 0);   
 -   matrix.setTextSize(1);    
 - 
 -   // print each letter with a rainbow color
 -   matrix.setTextColor(matrix.Color333(7, 0, 0));
 -   matrix.print('1');
 -   matrix.setTextColor(matrix.Color333(7, 4, 0));
 -   matrix.print('6');
 -   matrix.setTextColor(matrix.Color333(7, 7, 0));
 -   matrix.print('x');
 -   matrix.setTextColor(matrix.Color333(4, 7, 0));
 -   matrix.print('3');
 -   matrix.setTextColor(matrix.Color333(0, 7, 0));
 -   matrix.print('2');
 - 
 -   matrix.setCursor(1, 9);   // next line
 -   matrix.setTextColor(matrix.Color333(0, 7, 7));
 -   matrix.print('*');
 -   matrix.setTextColor(matrix.Color333(0, 4, 7));
 -   matrix.print('R');
 -   matrix.setTextColor(matrix.Color333(0, 0, 7));
 -   matrix.print('G');
 -   matrix.setTextColor(matrix.Color333(4, 0, 7));
 -   matrix.print('B');
 -   matrix.setTextColor(matrix.Color333(7, 0, 4));
 -   matrix.print("*");
 -   delay(5000);
 - }
 
  复制代码
  
 
 |