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.
main.cpp@0:af8bf6fc6a0f, 2015-10-03 (annotated)
- Committer:
- wd5gnr
- Date:
- Sat Oct 03 18:09:11 2015 +0000
- Revision:
- 0:af8bf6fc6a0f
Simple demo for HaD
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| wd5gnr | 0:af8bf6fc6a0f | 1 | #include "mbed.h" |
| wd5gnr | 0:af8bf6fc6a0f | 2 | |
| wd5gnr | 0:af8bf6fc6a0f | 3 | PwmOut myled(dp1); |
| wd5gnr | 0:af8bf6fc6a0f | 4 | |
| wd5gnr | 0:af8bf6fc6a0f | 5 | int main() |
| wd5gnr | 0:af8bf6fc6a0f | 6 | { |
| wd5gnr | 0:af8bf6fc6a0f | 7 | int i,j; |
| wd5gnr | 0:af8bf6fc6a0f | 8 | while(1) |
| wd5gnr | 0:af8bf6fc6a0f | 9 | { |
| wd5gnr | 0:af8bf6fc6a0f | 10 | for (j=0;j<2;j++) |
| wd5gnr | 0:af8bf6fc6a0f | 11 | for (i=0;i<1000;i+=10) |
| wd5gnr | 0:af8bf6fc6a0f | 12 | { |
| wd5gnr | 0:af8bf6fc6a0f | 13 | float pwm=i/1000.0; |
| wd5gnr | 0:af8bf6fc6a0f | 14 | myled=j?1.0-pwm:pwm; |
| wd5gnr | 0:af8bf6fc6a0f | 15 | wait(0.01); |
| wd5gnr | 0:af8bf6fc6a0f | 16 | } |
| wd5gnr | 0:af8bf6fc6a0f | 17 | } |
| wd5gnr | 0:af8bf6fc6a0f | 18 | } |