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
Fork of Dragonfly_AnalogIn_Example by
main.cpp@0:436a6a6b80a1, 2015-10-02 (annotated)
- Committer:
- mfiore
- Date:
- Fri Oct 02 13:35:19 2015 +0000
- Revision:
- 0:436a6a6b80a1
- Child:
- 1:ceddded7137c
initial commit
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| mfiore | 0:436a6a6b80a1 | 1 | /** Dragonfly AnalogIn Example Program |
| mfiore | 0:436a6a6b80a1 | 2 | * |
| mfiore | 0:436a6a6b80a1 | 3 | * This program demonstrates how to read an anglog pin using the |
| mfiore | 0:436a6a6b80a1 | 4 | * MultiTech Dragonfly and MultiTech UDK2 hardware. The only |
| mfiore | 0:436a6a6b80a1 | 5 | * additional hardware required is an analog voltage source like |
| mfiore | 0:436a6a6b80a1 | 6 | * a potentiometer. |
| mfiore | 0:436a6a6b80a1 | 7 | * |
| mfiore | 0:436a6a6b80a1 | 8 | * |
| mfiore | 0:436a6a6b80a1 | 9 | * This program reads the analog input connected to pin A0 and |
| mfiore | 0:436a6a6b80a1 | 10 | * prints the result. |
| mfiore | 0:436a6a6b80a1 | 11 | */ |
| mfiore | 0:436a6a6b80a1 | 12 | |
| mfiore | 0:436a6a6b80a1 | 13 | #include "mbed.h" |
| mfiore | 0:436a6a6b80a1 | 14 | |
| mfiore | 0:436a6a6b80a1 | 15 | int main() { |
| mfiore | 0:436a6a6b80a1 | 16 | AnalogIn in(A0); |
| mfiore | 0:436a6a6b80a1 | 17 | |
| mfiore | 0:436a6a6b80a1 | 18 | while (true) { |
| mfiore | 0:436a6a6b80a1 | 19 | printf("analog value: 0x%04X\r\n", in.read_u16()); |
| mfiore | 0:436a6a6b80a1 | 20 | wait_ms(500); |
| mfiore | 0:436a6a6b80a1 | 21 | } |
| mfiore | 0:436a6a6b80a1 | 22 | } |
