微處理器 - STCmicro STC15W408AS - C/C++ - Button



Button是連接到P3.2


P3


main.c

#include <mcs51/8051.h>

#define LED P1_0
#define BTN P3_2
 
void main(void)
{
    BTN = 1;

    while (1) {
        LED = BTN;
    }
}

完成