bianchi77
Advanced Member level 4
- Joined
- Jun 11, 2009
- Messages
- 1,313
- Helped
- 21
- Reputation
- 44
- Reaction score
- 20
- Trophy points
- 1,318
- Location
- California
- Activity points
- 9,442
Guys,
How can I read a button from GPIO PC0 ?
I have created :
any opinions ?
thanks
How can I read a button from GPIO PC0 ?
I have created :
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOE | RCC_APB2Periph_GPIOA, ENABLE); //initialize PC0 and PC1 as button input GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 ; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD; // this sets up input to be used with external push up/pull down resistors. GPIO_Init(GPIOC, &GPIO_InitStructure); .. .. .. uint8_t button1; button1 = GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_0); if (button1 == 0x00) { lcd_string("Button 1 is pressed.."); }
any opinions ?
thanks
Last edited by a moderator: