/* This Arduino code for "4-digit-7-segment-led-display" (KYX-5461AS). * This code can display one Number in all 4 digit! * This code can display 4 Numbers each on in specific digit * This code can also make a Number Countdown (Timers). author : Oussama Amri (@amriunix) website : ithepro.com */ //display pins int segA = 5; // >> 11 int segB = 13; // >> 7 int segC = 10; // >> 4 int segD = 8; // >> 2 int segE = 7; // >> 1 int segF = 4; // >> 10 int segG = 11; // >> 5 int segPt = 9; // >> 3 //------------// //display digit int d1 = 6; // >> 12 int d2 = 3; // >> 9 int d3 = 2; // >> 8 int d4 = 12; // >> 6 //------------// int delayTime = 5000; //delayTime int mydelay = 3000; // 50 is about one second, 3000 a minute int i=0; //=============================================// //init all pin used void setup() { pinMode(2, OUTPUT); pinMode(3, OUTPUT); pinMode(4, OUTPUT); pinMode(5, OUTPUT); pinMode(6, OUTPUT); pinMode(7, OUTPUT); pinMode(8, OUTPUT); pinMode(9, OUTPUT); pinMode(10, OUTPUT); pinMode(11, OUTPUT); pinMode(12, OUTPUT); pinMode(13, OUTPUT); } //=============================================// void loop() { downup(0,20,9,0); // numbers above 19 display as blank. //all(8); //writeN(1,9,0,4); } //=============================================// //Write a Number - writeN(1,9,9,0) -> 1990 void writeN(int a,int b,int c,int d){ selectDwriteL(1,a); selectDwriteL(2,b); selectDwriteL(3,c); selectDwriteL(4,d); } //=============================================// //Make a Number Number Countdown (Timers). void downup(int a,int b,int c,int d){ while (a != -1) { while(b != -1){ while(c != -1){ while (d != -1) { while (i