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:624654c26647, 2010-09-12 (annotated)
- Committer:
- matsumur
- Date:
- Sun Sep 12 13:27:59 2010 +0000
- Revision:
- 0:624654c26647
- Child:
- 1:8add664df717
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
matsumur | 0:624654c26647 | 1 | //LEDs indicate a binary numeral and the numeral is increasing with 0.2sec intervals. |
matsumur | 0:624654c26647 | 2 | //by Kohei Matsumura |
matsumur | 0:624654c26647 | 3 | |
matsumur | 0:624654c26647 | 4 | #include "mbed.h" |
matsumur | 0:624654c26647 | 5 | |
matsumur | 0:624654c26647 | 6 | DigitalOut led1(LED1); |
matsumur | 0:624654c26647 | 7 | DigitalOut led2(LED2); |
matsumur | 0:624654c26647 | 8 | DigitalOut led3(LED3); |
matsumur | 0:624654c26647 | 9 | DigitalOut led4(LED4); |
matsumur | 0:624654c26647 | 10 | |
matsumur | 0:624654c26647 | 11 | int main() { |
matsumur | 0:624654c26647 | 12 | int i=0; |
matsumur | 0:624654c26647 | 13 | |
matsumur | 0:624654c26647 | 14 | while(1) { |
matsumur | 0:624654c26647 | 15 | wait(0.2); |
matsumur | 0:624654c26647 | 16 | led1 = i & 0x01; |
matsumur | 0:624654c26647 | 17 | led2 = i>>1 & 0x01; |
matsumur | 0:624654c26647 | 18 | led3 = i>>2 & 0x01; |
matsumur | 0:624654c26647 | 19 | led4 = i>>3 & 0x01; |
matsumur | 0:624654c26647 | 20 | |
matsumur | 0:624654c26647 | 21 | if(i>0x0f){ |
matsumur | 0:624654c26647 | 22 | i=0; |
matsumur | 0:624654c26647 | 23 | }else{ |
matsumur | 0:624654c26647 | 24 | i++; |
matsumur | 0:624654c26647 | 25 | } |
matsumur | 0:624654c26647 | 26 | } |
matsumur | 0:624654c26647 | 27 | } |