Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
led_func.h
00001 #include "necleo_pin.h" 00002 00003 #define L 0 00004 #define H 1 00005 00006 #define R 0 00007 #define G 1 00008 #define B 2 00009 00010 class Dot{ 00011 public: 00012 bool red; 00013 bool green; 00014 bool blue; 00015 }; 00016 00017 Dot led_board[16][16]; 00018 00019 void ResetBoard(){ 00020 for(char i=0;i<16;i++){ 00021 for(char j=0;j<16;j++){ 00022 led_board[i][j].red=false; 00023 led_board[i][j].green=false; 00024 led_board[i][j].blue=false; 00025 } 00026 } 00027 } 00028 00029 void PrintBoard(){ 00030 CLK=0; 00031 LAT=0; 00032 for(char i=0;i<4;i++){ 00033 OE=H; 00034 Address=i; 00035 for(char j=0;j<32;j++){ 00036 if(i<16){ 00037 Red1=led_board[i][j].red; 00038 Green1=led_board[i][j].green; 00039 Blue1=led_board[i][j].blue; 00040 Red2=led_board[i+8][j].red; 00041 Green2=led_board[i+8][j].green; 00042 Blue2=led_board[i+8][j].blue; 00043 }else{ 00044 Red1=led_board[i+4][j-16].red; 00045 Green1=led_board[i+4][j-16].green; 00046 Blue1=led_board[i+4][j-16].blue; 00047 Red2=led_board[i+12][j-16].red; 00048 Green2=led_board[i+12][j-16].green; 00049 Blue2=led_board[i+12][j-16].blue; 00050 } 00051 wait_us(10); 00052 CLK=H; 00053 wait_us(10); 00054 CLK=L; 00055 } 00056 wait_us(10); 00057 LAT=H; 00058 wait_us(10); 00059 LAT=L; 00060 OE=L; 00061 wait_us(100); 00062 } 00063 } 00064 /*class LED{ 00065 public: 00066 char led_board[16][16]; 00067 void ResetBoard(){ 00068 for(char i=0;i<16;i++){ 00069 for(char j=0;j<16;j++){ 00070 this->led_board[i][j]=1; 00071 } 00072 } 00073 } 00074 void ResetPin(){ 00075 Address=0; 00076 OE=H; 00077 CLK=L; 00078 LAT=L; 00079 } 00080 void PrintLine(char board[16][16],char line){ 00081 this->ResetPin(); 00082 Address=line; 00083 for(char i=0;i<32;i++){ 00084 if(i<16){ 00085 Red1=board[line][i]&R; 00086 Green1=board[line][i]&G; 00087 Blue1=board[line][i]&B; 00088 Red2=board[line+8][i]&R; 00089 Green2=board[line+8][i]&G; 00090 Blue2=board[line+8][i]&B; 00091 }else{ 00092 Red1=board[line+4][i-16]&R; 00093 Green1=board[line+4][i-16]&G; 00094 Blue1=board[line+4][i-16]&B; 00095 Red2=board[line+12][i-16]&R; 00096 Green2=board[line+12][i-16]&G; 00097 Blue2=board[line+12][i-16]&B; 00098 } 00099 CLK=H; 00100 CLK=L; 00101 } 00102 LAT=H; 00103 LAT=L; 00104 OE=L; 00105 } 00106 void PrintBoard(){ 00107 for(char i=0;i<4;i++){ 00108 PrintLine(this->led_board,i); 00109 wait_us(100); 00110 } 00111 } 00112 };*/
Generated on Wed Jul 13 2022 23:06:20 by
1.7.2