Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-STM32F103C8T6 mbed
main.cpp@0:7370c6a639a4, 2017-04-29 (annotated)
- Committer:
- BaserK
- Date:
- Sat Apr 29 15:29:18 2017 +0000
- Revision:
- 0:7370c6a639a4
*
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| BaserK | 0:7370c6a639a4 | 1 | #include "stm32f103c8t6.h" |
| BaserK | 0:7370c6a639a4 | 2 | #include "mbed.h" |
| BaserK | 0:7370c6a639a4 | 3 | |
| BaserK | 0:7370c6a639a4 | 4 | // AnalogIn example |
| BaserK | 0:7370c6a639a4 | 5 | // Reads analog data from a pin and prints it to the com port |
| BaserK | 0:7370c6a639a4 | 6 | |
| BaserK | 0:7370c6a639a4 | 7 | AnalogIn analog(PB_0); |
| BaserK | 0:7370c6a639a4 | 8 | Serial com(PA_2, PA_3); |
| BaserK | 0:7370c6a639a4 | 9 | |
| BaserK | 0:7370c6a639a4 | 10 | float data = 0; |
| BaserK | 0:7370c6a639a4 | 11 | |
| BaserK | 0:7370c6a639a4 | 12 | int main() |
| BaserK | 0:7370c6a639a4 | 13 | { |
| BaserK | 0:7370c6a639a4 | 14 | confSysClock(); //Configure system clock (72MHz HSE clock, 48MHz USB clock) |
| BaserK | 0:7370c6a639a4 | 15 | com.baud(9600); |
| BaserK | 0:7370c6a639a4 | 16 | |
| BaserK | 0:7370c6a639a4 | 17 | while (1) |
| BaserK | 0:7370c6a639a4 | 18 | { |
| BaserK | 0:7370c6a639a4 | 19 | data = analog.read(); |
| BaserK | 0:7370c6a639a4 | 20 | com.printf("Analog data is: %.2f \r\n", data); |
| BaserK | 0:7370c6a639a4 | 21 | wait(0.1); |
| BaserK | 0:7370c6a639a4 | 22 | } |
| BaserK | 0:7370c6a639a4 | 23 | } |