BLINKING LED PROGRAM IN LPC2129

          BLINKING LED PROGRAM IN LPC2129





program for push-button input and making on and off led other wise blink another led ?

#include<lpc21xx.h>       //include libray
void delay(int count)      //user delay funcation
{
int i,j;
for(i=0;i<count;i++)
{
for(j=0;j<5000;j++)      //delay = count*5000
{
}
}
}
int main()
{
IODIR0=IODIR0|(1<<17)|(1<<24);  //direction to led pins
IODIR0=IODIR0&~(1<<25);          // direction to input
while(1)                                            // it will be for repeat loop
{
if(IOPIN0&(1<<25))                      // iopin for checking input iopin default is zero
{
IOSET0=(1<<17) ;                        // ioset for making high
delay(1000);                                   //calling delay function
IOCLR0=(1<<17);                         // ioclr for making low
delay(1000);
}
else                                         //other wise blinking on other led
{
IOSET0=(1<<24);
delay(1000);
IOCLR0=(1<<24);
delay(1000);
}
}
}


program for blinking LEDs up-down and countdown system? 


#include<lpc21xx.h>
void delay(int count)
{
int i,j;
for(i=0;i<count;i++)
{
 for(j=0;j<5000;j++)
{
}
}
}
int main()
{
int i;
for(i=17;i!=25;i++)
{
IODIR0=IODIR0|(1<<i)  ;
}
while(1)
{
int num;
for(num=17;num!=24;num++)
{
IOSET0=(1<<num);
delay(300);
IOCLR0=(1<<num);
delay(300);
 }
 for(num=24;num!=17;num--)
{
IOSET0=(1<<num);
delay(300);
IOCLR0=(1<<num);
delay(300);
 }
}
}

program based on the pattern blinking?


#include<lpc21xx.h>
void delay(int count)
{
int i,j;
for(i=0;i<count;i++)
{
 for(j=0;j<5000;j++)
{
}
}
}
int main()
{
int i;
for(i=17;i!=25;i++)
{
IODIR0=IODIR0|(1<<i)  ;
}
while(1)
{
int num;
for(i=17;i!=24;i++)
{
 IOSET0=(1<<i);
 for(num=i;num!=24;num++)
{
IOSET0=(1<<num);
delay(100);
IOCLR0=(1<<num);
delay(100);
 }
}
}
}

Comments

Popular posts from this blog

READING VALUES FROM SENSOR AND THAT WRITING TO EEPROM

Smart Power management system in any management system

project for checking status of lights very day 12 :11 am