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 Zoltan Hudak

Committer:
hudakz
Date:
Thu Sep 15 18:40:03 2016 +0000
Revision:
10:4b88be251088
Parent:
9:d3fb631890d7
Child:
12:c11b1e5546b0
Updated.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hudakz 5:3c3ef17a17a6 1 #include "stm32f103c8t6.h"
hudakz 0:ab218237069e 2 #include "mbed.h"
hudakz 10:4b88be251088 3
hudakz 0:ab218237069e 4 int main() {
hudakz 10:4b88be251088 5 confSysClock(); //Configure system clock (72MHz HSE clock, 48MHz USB clock)
hudakz 10:4b88be251088 6
hudakz 10:4b88be251088 7 Serial pc(PA_2, PA_3);
hudakz 10:4b88be251088 8 DigitalOut myled(LED1);
hudakz 10:4b88be251088 9
hudakz 0:ab218237069e 10 while(1) {
hudakz 5:3c3ef17a17a6 11 // The on-board LED is connected, via a resistor, to +3.3V (not to GND).
hudakz 3:c6a589f444b9 12 // So to turn the LED on or off we have to set it to 0 or 1 respectively
hudakz 7:accb2c83a007 13 myled = 0; // turn the LED on
hudakz 10:4b88be251088 14 wait_ms(200); // 200 millisecond
hudakz 7:accb2c83a007 15 myled = 1; // turn the LED off
hudakz 10:4b88be251088 16 wait_ms(1000); // 1000 millisecond
hudakz 5:3c3ef17a17a6 17 pc.printf("Blink\r\n");
hudakz 0:ab218237069e 18 }
hudakz 0:ab218237069e 19 }
hudakz 8:f1432e9af6c8 20