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 Lab1_Part9 by
main.cpp@3:e09fd735ed93, 2018-01-31 (annotated)
- Committer:
- bjs9
- Date:
- Wed Jan 31 18:21:06 2018 +0000
- Revision:
- 3:e09fd735ed93
- Parent:
- 2:29ca1063cbc3
- Child:
- 4:e4aed7bf3e21
change in code
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| bjs9 | 0:a0adc5ccd394 | 1 | #include "mbed.h" |
| bjs9 | 0:a0adc5ccd394 | 2 | #include <math.h> |
| bjs9 | 0:a0adc5ccd394 | 3 | |
| bjs9 | 0:a0adc5ccd394 | 4 | #ifndef M_PI |
| bjs9 | 0:a0adc5ccd394 | 5 | #define M_PI 3.1415 |
| bjs9 | 0:a0adc5ccd394 | 6 | #endif |
| bjs9 | 0:a0adc5ccd394 | 7 | |
| bjs9 | 0:a0adc5ccd394 | 8 | AnalogOut aout(p18); |
| bjs9 | 0:a0adc5ccd394 | 9 | float value = 0.0f; |
| bjs9 | 0:a0adc5ccd394 | 10 | |
| bjs9 | 0:a0adc5ccd394 | 11 | int main() |
| bjs9 | 0:a0adc5ccd394 | 12 | { |
| bjs9 | 0:a0adc5ccd394 | 13 | const double pi = 3.141592653589793238462; |
| bjs9 | 0:a0adc5ccd394 | 14 | while (1) { |
| bjs9 | 2:29ca1063cbc3 | 15 | for(int i= 0; i < 20; i++ ){ |
| bjs9 | 3:e09fd735ed93 | 16 | aout = sin(2 *pi * i/20); |
| bjs9 | 1:f21f8ffcd1b6 | 17 | //printf("aout = %1.2f volts\n",aout.read()); |
| bjs9 | 1:f21f8ffcd1b6 | 18 | } |
| bjs9 | 0:a0adc5ccd394 | 19 | } |
| bjs9 | 0:a0adc5ccd394 | 20 | } |
