
Demo for reading DS1820 temperature sensor with STM32F103C8T6 board.
Reading DS1820 temperature sensor with STM32F103C8T6 board
Import the program into your online compiler.
Schematic
Wiring
STM32F103C8T6 | DS1820 | |||
---|---|---|---|---|
GND | <=> | GND | ||
PA_9 | <=> | DQ | ||
3.3V | <=> | VDD |
Revision 2:171926fbefb3, committed 2019-02-05
- Comitter:
- hudakz
- Date:
- Tue Feb 05 12:56:14 2019 +0000
- Parent:
- 1:93ec3038c226
- Child:
- 3:99631e445ec4
- Commit message:
- Updated.
Changed in this revision
--- a/DS1820.lib Fri Jan 06 19:27:54 2017 +0000 +++ b/DS1820.lib Tue Feb 05 12:56:14 2019 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/hudakz/code/DS1820/#b593a82ce790 +http://mbed.org/users/hudakz/code/DS1820/#74d2a4ac7f32
--- a/main.cpp Fri Jan 06 19:27:54 2017 +0000 +++ b/main.cpp Tue Feb 05 12:56:14 2019 +0000 @@ -5,19 +5,18 @@ * between the DS1820's data pin and the +3.3V pin * */ -#include "stm32f103c8t6.h" #include "mbed.h" #include "DS1820.h" -int main() { - confSysClock(); //Configure system clock (72MHz HSE clock, 48MHz USB clock) +Serial pc(PA_2, PA_3); +DigitalOut led(LED1); +DS1820 ds1820(PA_9); // substitute PA_9 with actual mbed pin name connected to the DS1820 data pin +float temp = 0; + +int main() +{ + int error = 0; - Serial pc(PA_2, PA_3); - DigitalOut led(LED1); - DS1820 ds1820(PA_9); // substitute PA_9 with actual mbed pin name connected to the DS1820 data pin - float temp = 0; - int error = 0; - if(ds1820.begin()) { while(1) { ds1820.startConversion(); // start temperature conversion from analog to digital
--- a/mbed-STM32F103C8T6.lib Fri Jan 06 19:27:54 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/hudakz/code/mbed-STM32F103C8T6/#09d8c2eacb4d
--- a/mbed.bld Fri Jan 06 19:27:54 2017 +0000 +++ b/mbed.bld Tue Feb 05 12:56:14 2019 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/99b5ccf27215 \ No newline at end of file +https://os.mbed.com/users/mbed_official/code/mbed/builds/3a7713b1edbc \ No newline at end of file