Micro-controllers, wireless transmission and database
This project assumes you have already installed STM32CubeIDE. You need to have previously done a basic blink sketch with blue-pill using STM32CubeIDE. I have made a complete video from installing STM32CubeIDE to LED blink program. You can watch it by clicking this link. https://www.youtube.com/watch?v=kXg467nVd_A
Set PB6, PB8 and PB9 to GPIO_Output
/* USER CODE BEGIN 0 */ #define SER_PIN GPIO_PIN_6 #define SER_PORT GPIOB #define RCLK_PIN GPIO_PIN_8 #define RCLK_PORT GPIOB #define SRCLK_PIN GPIO_PIN_9 #define SRCLK_PORT GPIOB uint8_t number[10] = {0b01110111, 0b00010100, 0b10110011, 0b10110110, 0b11010100, 0b11100110, 0b11100111, 0b00110100, 0b11110111, 0b11110110}; void HC595write(uint8_t val) { for(int i=0; i<8; i++) { if(number[val] & (1<<i)) { HAL_GPIO_WritePin(SER_PORT, SER_PIN, GPIO_PIN_SET); } else { HAL_GPIO_WritePin(SER_PORT, SER_PIN, GPIO_PIN_RESET); } HAL_GPIO_WritePin(SRCLK_PORT, SRCLK_PIN, GPIO_PIN_SET); HAL_GPIO_WritePin(SRCLK_PORT, SRCLK_PIN, GPIO_PIN_RESET); } HAL_GPIO_WritePin(RCLK_PORT, RCLK_PIN, GPIO_PIN_SET); HAL_GPIO_WritePin(RCLK_PORT, RCLK_PIN, GPIO_PIN_RESET); } /* USER CODE END 0 */ /* USER CODE BEGIN WHILE */ while (1) { for(int x=0; x<10; x++) { HC595write(x); HAL_Delay(1000); } /* USER CODE END WHILE */