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 p2_analogin by
hello.cpp@1:21ceeb2d4501, 2015-09-29 (annotated)
- Committer:
- Sersd
- Date:
- Tue Sep 29 18:02:37 2015 +0000
- Revision:
- 1:21ceeb2d4501
- Parent:
- 0:00529fca1abf
bn
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Sersd | 0:00529fca1abf | 1 | // Flash an LED while a DigitalIn is true |
Sersd | 0:00529fca1abf | 2 | |
Sersd | 0:00529fca1abf | 3 | #include "mbed.h" |
Sersd | 1:21ceeb2d4501 | 4 | |
Sersd | 0:00529fca1abf | 5 | |
Sersd | 1:21ceeb2d4501 | 6 | PwmOut pwmx(p26); |
Sersd | 1:21ceeb2d4501 | 7 | PwmOut pwmy(p21); |
Sersd | 1:21ceeb2d4501 | 8 | |
Sersd | 1:21ceeb2d4501 | 9 | |
Sersd | 1:21ceeb2d4501 | 10 | float pointx[] = {(0.00),(0.01),(0.02)}; |
Sersd | 1:21ceeb2d4501 | 11 | float pointy[] = {(0.00),(0.02),(0.00)}; |
Sersd | 0:00529fca1abf | 12 | |
Sersd | 0:00529fca1abf | 13 | int main() { |
Sersd | 1:21ceeb2d4501 | 14 | |
Sersd | 1:21ceeb2d4501 | 15 | // Matrix myMatrix(4,2); |
Sersd | 1:21ceeb2d4501 | 16 | // Matrix anotherMatrix; |
Sersd | 1:21ceeb2d4501 | 17 | |
Sersd | 1:21ceeb2d4501 | 18 | // Fill Matrix with data. |
Sersd | 1:21ceeb2d4501 | 19 | // myMatrix << 2 << 2 << 3 |
Sersd | 1:21ceeb2d4501 | 20 | // << 4 << 5 << 6; |
Sersd | 1:21ceeb2d4501 | 21 | |
Sersd | 1:21ceeb2d4501 | 22 | pwmx.period(0.02f); // 4 second period |
Sersd | 1:21ceeb2d4501 | 23 | pwmy.period(0.02f); |
Sersd | 1:21ceeb2d4501 | 24 | |
Sersd | 0:00529fca1abf | 25 | while(1) { |
Sersd | 1:21ceeb2d4501 | 26 | for(int i=0;i<3;i++){ |
Sersd | 1:21ceeb2d4501 | 27 | pwmx.pulsewidth(pointx[i]); |
Sersd | 1:21ceeb2d4501 | 28 | pwmy.pulsewidth(pointy[i]); |
Sersd | 1:21ceeb2d4501 | 29 | wait(0.02f); |
Sersd | 0:00529fca1abf | 30 | } |
Sersd | 0:00529fca1abf | 31 | } |
Sersd | 1:21ceeb2d4501 | 32 | |
Sersd | 1:21ceeb2d4501 | 33 | |
Sersd | 1:21ceeb2d4501 | 34 | } |