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
Click connectivity --> Click I2C2
For I2C select I2C
Configuration --> Parameter Settings
For I2C speed select Fast Mode
Inside Core/Inc Folder
fonts.h ssd1306.hInside Core/Src Folder
fonts.c ssd1306.c/* USER CODE BEGIN Includes */ #include "fonts.h" #include "ssd1306.h" /* USER CODE END Includes */ /* USER CODE BEGIN 0 */ void setTCAChannel(uint8_t i){ uint8_t channel = 1 << i; HAL_I2C_Master_Transmit(&hi2c2, (0x70 << 1), &channel, 1, 1000); } /* USER CODE END 0 */ /* USER CODE BEGIN 2 */ char snum[5]; setTCAChannel(2); SSD1306_Init(); SSD1306_GotoXY (0,0); SSD1306_Puts ("TCA9548A", &Font_11x18, 1); SSD1306_GotoXY (0, 30); SSD1306_Puts ("Multiplexer", &Font_11x18, 1); SSD1306_UpdateScreen(); setTCAChannel(3); SSD1306_Init(); SSD1306_GotoXY (0,0); SSD1306_Puts ("STM32", &Font_11x18, 1); SSD1306_GotoXY (0, 30); SSD1306_Puts ("BluePill", &Font_11x18, 1); SSD1306_UpdateScreen(); setTCAChannel(4); SSD1306_Init(); SSD1306_GotoXY (0,0); SSD1306_Puts ("MicroPeta", &Font_11x18, 1); SSD1306_GotoXY (0, 30); SSD1306_Puts (".Com", &Font_11x18, 1); SSD1306_UpdateScreen(); setTCAChannel(5); SSD1306_Init(); SSD1306_GotoXY (0,0); SSD1306_Puts ("Nizar", &Font_11x18, 1); SSD1306_GotoXY (0, 30); SSD1306_Puts ("Mohideen", &Font_11x18, 1); SSD1306_UpdateScreen(); HAL_Delay (5000); for ( int x = 1; x <= 10000 ; x++ ) { setTCAChannel(2); itoa(x, snum, 10); SSD1306_Clear(); SSD1306_GotoXY (0,0); SSD1306_Puts ("1 Time", &Font_11x18, 1); SSD1306_GotoXY (0, 30); SSD1306_Puts (snum, &Font_16x26, 1); SSD1306_UpdateScreen(); setTCAChannel(3); itoa(x*2, snum, 10); SSD1306_Clear(); SSD1306_GotoXY (0,0); SSD1306_Puts ("2 Times", &Font_11x18, 1); SSD1306_GotoXY (0, 30); SSD1306_Puts (snum, &Font_16x26, 1); SSD1306_UpdateScreen(); setTCAChannel(4); itoa(x*3, snum, 10); SSD1306_Clear(); SSD1306_GotoXY (0,0); SSD1306_Puts ("3 Times", &Font_11x18, 1); SSD1306_GotoXY (0, 30); SSD1306_Puts (snum, &Font_16x26, 1); SSD1306_UpdateScreen(); setTCAChannel(5); itoa(x*4, snum, 10); SSD1306_Clear(); SSD1306_GotoXY (0,0); SSD1306_Puts ("4 Times", &Font_11x18, 1); SSD1306_GotoXY (0, 30); SSD1306_Puts (snum, &Font_16x26, 1); SSD1306_UpdateScreen(); HAL_Delay (500); } /* USER CODE END 2 */