An example of how to communicate with 1Wire devices from the STM32F103C8T6 (on the cheap "Bluepill" board)
Dependencies: DS1820 mbed-STM32F103C8T6 mbed
Fork of STM32F103C8T6_Hello by
main.cpp
- Committer:
- deece
- Date:
- 2018-01-12
- Revision:
- 13:c91214d92d70
- Parent:
- 12:c11b1e5546b0
File content as of revision 13:c91214d92d70:
#include "stm32f103c8t6.h" #include "mbed.h" #include "DS1820.h" #define DATA_PIN PA_7 int main() { DS1820 probe(DATA_PIN); while(1) { printf("Initiating temperature conversion\r\n"); probe.convertTemperature(true, DS1820::this_device); //Start temperature conversion, wait until ready double temperature = probe.temperature(); int temp_integer = temperature; int temp_milli = (temperature - temp_integer) * 1000; printf("It is %d.%03dC\r\n", temp_integer, temp_milli); wait(1000); } }