initial upload
This commit is contained in:
parent
f576ef27ce
commit
5e20a17131
17 changed files with 1163 additions and 0 deletions
|
@ -0,0 +1,48 @@
|
|||
// Author:Frankie.Chu
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#include "TM1637.h"
|
||||
#define CLK 2//pins definitions for TM1637 and can be changed to other ports
|
||||
#define DIO 3
|
||||
TM1637 tm1637(CLK,DIO);
|
||||
void setup()
|
||||
{
|
||||
tm1637.init();
|
||||
tm1637.set(BRIGHT_TYPICAL);//BRIGHT_TYPICAL = 2,BRIGHT_DARKEST = 0,BRIGHTEST = 7;
|
||||
}
|
||||
void loop()
|
||||
{
|
||||
int8_t NumTab[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};//0~9,A,b,C,d,E,F
|
||||
int8_t ListDisp[4];
|
||||
unsigned char i = 0;
|
||||
unsigned char count = 0;
|
||||
delay(150);
|
||||
while(1)
|
||||
{
|
||||
i = count;
|
||||
count ++;
|
||||
if(count == sizeof(NumTab)) count = 0;
|
||||
for(unsigned char BitSelect = 0;BitSelect < 4;BitSelect ++)
|
||||
{
|
||||
ListDisp[BitSelect] = NumTab[i];
|
||||
i ++;
|
||||
if(i == sizeof(NumTab)) i = 0;
|
||||
}
|
||||
tm1637.display(0,ListDisp[0]);
|
||||
tm1637.display(1,ListDisp[1]);
|
||||
tm1637.display(2,ListDisp[2]);
|
||||
tm1637.display(3,ListDisp[3]);
|
||||
delay(300);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue