IO口电压是3.3V,LED压降一般是1.7V左右,LED电流一般取5mA~15mA(电视遥控器红外那么大的LED),
如果LED电流设定为5mA(一般也够),限流电阻的大小 = (3.3-1.7)/0.005 = 320,
320Ω的电阻不好找的话,就用330Ω也基本不影响,或者也可以用300Ω
如果LED灯特别小,也有2mA
512个限流电阻~~~用排阻会好些吧
int main(void){
SystemInit()
/* 开启GPIO时钟 */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE)
GPIO_InitTypeDef GPIO_InitStructure
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP
GPIO_Init(GPIOC, &GPIO_InitStructure)
GPIO_ResetBits(GPIOC,GPIO_Pin_13)
while(1)
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)