#include <reg51.h> sbit bt=P1^0; void main() { while(1) { if(bt==0) { P2=0x00; } else { P2=0xFF; } } }