博文

目前显示的是 七月, 2025的博文

How to create a Ready-to-use STM32CubeIDE project for DS18B20?

图片
 Here's a step-by-step guide to create a ready-to-use STM32CubeIDE project for reading temperature from the DS18B20 sensor using STM32 HAL . The example assumes you're using STM32F103C8T6 ("Blue Pill") but can be adapted to other STM32 chips. Project Overview Microcontroller : STM32F103C8T6 Sensor : DS18B20 Interface : 1-Wire protocol (bit-banged using GPIO) Development Tool : STM32CubeIDE Library : MaJerle's OneWire and DS18B20 drivers (HAL-compatible) Wiring Recap DS18B20 Pin Connect To STM32 GND GND VDD 3.3V DQ PA1 (or your chosen GPIO) 4.7 kΩ Between DQ and VDD Project Setup Steps  1. Create a New Project Open STM32CubeIDE File → New → STM32 Project Select STM32F103C8T6 (or your MCU) Name your project: DS18B20_Project  2. Configure GPIO Open .ioc file Set PA1 as GPIO_Output Enable USART1 (optional, for serial print/debug) Enable SYS → Debug: Serial Wire (for SWD debugging)  3. Add DS18B20 + On...