Privacy statement: Your privacy is very important to Us. Our company promises not to disclose your personal information to any external company with out your explicit permission.
MCU button start and stop led light program
#include
Void Delay(unsigned int t); sbit key=P3^2; // corresponding to the s19 button on the microcontroller development board
Void main (void)
{
While (1) / / after the function starts, it is always detecting whether the button is pressed
{
If(key==0) {
Unsigned char i; //Define an unsigned char type local variable i from 0 to 255
P0 = 0x7f; / / assign the initial value, the first light on the right lights up
For(i=0;i<8;i++) //Add a for loop, indicating that the program loop in the for loop is executed 8 times.
{
Delay (50000);
P0>>=1; // Move one bit to the right.
P0=P0|0x80; //After shifting right, the left end is automatically assigned 0, so the statement needs to be assigned 1
}
}
Else
{
P0=0x00;
}
} }
Void Delay(unsigned int t)
{
While(--t);
}
October 29, 2024
On April 22, network activity named "FAST 2015 -! OPEN DAY" was launched by a brand LED high-power outdoor lighting manufacturer- Shenzhen Lead Optoelectronics Technology Co., Ltd.(Chinese name is...
Recently, the world's leading watch brand Hublot and brand ambassador, legendary track and field athlete Usain Bolt hand in hand into Kyoto, the ancient capital of Japan, with passion to ignite...
This article is reproduced, does not represent the world position of million table.
After two years of breakthrough in the laboratory's light efficiency of 200 lm/W, Cree has finally produced the series of LED chips with 200 lumens per watt at the end of 2012, and officially...
Email to this supplier
October 29, 2024
Privacy statement: Your privacy is very important to Us. Our company promises not to disclose your personal information to any external company with out your explicit permission.
Fill in more information so that we can get in touch with you faster
Privacy statement: Your privacy is very important to Us. Our company promises not to disclose your personal information to any external company with out your explicit permission.