基于单片机声光双控路灯仿真设计
1467下载地址 https://docs.qq.com/doc/DWEpnR2pOWU91b3p4?pub=1&dver=2.1.0
#include <reg52.h> sbit guang = P0 ^ 2; sbit shen = P2 ^ 0; void delay( unsigned char a ) { while ( --a ) ; } void main() { unsigned char i = 0; unsigned char j = 0; unsigned char k = 0; while ( 1 ) { //没有光的情况下 if ( guang == 0) { //判断有无声音