/var/www/restricted/ssh/stm32/www/stm32circle/
phpMyVisites | Open source web analytics
Pages: 1
how to light a single LED? help please
#include "stm32f10x.h" #define LEDS_GPIO (GPIOE) #define LED0_PIN (GPIO_Pin_0) #define LED1_PIN (GPIO_Pin_1) #define LED2_PIN (GPIO_Pin_11) #define LED3_PIN (GPIO_Pin_12) #define LEDS_PINS (LED0_PIN|LED1_PIN|LED2_PIN|LED3_PIN) GPIO_InitTypeDef GPIO_IS; volatile unsigned char toggle = 0; int main( void ) { while (1) { GPIO_IS.GPIO_Pin = LED0_PIN; GPIO_IS.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_IS.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init( LEDS_GPIO, &GPIO_IS); GPIO_Write( LEDS_GPIO, ( 1 ) ); } }
what's wrong?
Offline
You must first start the clock on the peripheral you want to use, before the configuration.In your case : RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOE, ENABLE );Note : it would be better to do the configuration only one time before the while (1)
and use the reset register GPIOX_BRR(X=A,B,C..) then you can rest the coreesponding ODRx bit.
As is does GPIO_Pin_7 mean pin 7 on the connector the AUDIO_I2S2_SCK port??? Is there a diagram or map for GPIO and USART that shows this?How could I drive a LED from one of the ports on the connector?led tube lightingLED SpotlightLED Downlight