ZigBee first opened

Source: Internet
Author: User

ZigBee Running lamp Design

#include <iocc2530.h>
#define UINT unsigned int
#define UCHAR unsigned char
//port to define control lights
#define LED1 p1_0//definition LED1 for P10 Port control
#define LED2 p1_1//define LED2 for P11 Port control
#define LED3 p0_4//define LED3 for P04 port control
//function declaration
Void Delay (UINT);//delay function
void InitIO (void);//Initialize LED control IO port function
/****************************
//delay
*********** /
void Delay (uint N)
{
UINT I;
for (i = 0;i<n;i++);
}
/****************************
//Initialize IO port program
*****************************/
Void InitIO (void)
{
P1dir |= 0x03; P10, P11 is defined as output
P0dir |= 0x10;//p04 is defined as output
LED1 = 1;
LED2 = 1;
LED3 = 1;//led light is initialized to off
}
/***************************
//main function
***************************/
Void Main (void)
{
InitIO ();//Initialize LED light control IO port
while (1)//Dead loop
{
LED1 =! LED1; LED1 light flashes once
Delay (50000);
LED2 =! LED2; LED2 light flashes once
Delay (50000);
LED3 =! LED3; LED3 light flashes once
Delay (50000);

}
}

ZigBee First Open

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.