main.c
#include "stm32f10x.h"
#include "led.h"
#include "delay.h"
#include "key.h"
#include "usart.h"
#include "at24c02.h"
#include "bh1750.h"
int main()
{
u8 val;
LED_Init();
BEEP_Init();
KeyInit();
USARTx_Init(USART1,72,115200);
IIC_Init();
while(1)
{
val=KeyScan();
if(val)
{
val=Read_BH1750_Data();
printf("光照强度=%d\r\n",val);
// BEEP=!BEEP;
LED0=!LED0;
LED1=!LED1;
}
}
}
|