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.
Fork of bynary_counting_Hello_World by
main.cpp@0:d6f93f0e46d4, 2010-12-07 (annotated)
- Committer:
- xeryus1206
- Date:
- Tue Dec 07 21:20:43 2010 +0000
- Revision:
- 0:d6f93f0e46d4
- Child:
- 1:77d533d0d869
my very first own program on mbed
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| xeryus1206 | 0:d6f93f0e46d4 | 1 | #include "mbed.h" |
| xeryus1206 | 0:d6f93f0e46d4 | 2 | |
| xeryus1206 | 0:d6f93f0e46d4 | 3 | DigitalOut bitzero(LED1); |
| xeryus1206 | 0:d6f93f0e46d4 | 4 | DigitalOut bitone(LED2); |
| xeryus1206 | 0:d6f93f0e46d4 | 5 | DigitalOut bittwo(LED3); |
| xeryus1206 | 0:d6f93f0e46d4 | 6 | DigitalOut bitthree(LED4); |
| xeryus1206 | 0:d6f93f0e46d4 | 7 | |
| xeryus1206 | 0:d6f93f0e46d4 | 8 | int main() { |
| xeryus1206 | 0:d6f93f0e46d4 | 9 | |
| xeryus1206 | 0:d6f93f0e46d4 | 10 | int counter; |
| xeryus1206 | 0:d6f93f0e46d4 | 11 | int b3,b2,b1,b0; |
| xeryus1206 | 0:d6f93f0e46d4 | 12 | |
| xeryus1206 | 0:d6f93f0e46d4 | 13 | while (1) { |
| xeryus1206 | 0:d6f93f0e46d4 | 14 | for (counter = 0; counter < 16; counter++) { |
| xeryus1206 | 0:d6f93f0e46d4 | 15 | |
| xeryus1206 | 0:d6f93f0e46d4 | 16 | b3=(counter > 7); |
| xeryus1206 | 0:d6f93f0e46d4 | 17 | b2=((counter-(b3*8)) > 3); |
| xeryus1206 | 0:d6f93f0e46d4 | 18 | b1=((counter-(b3*8)-(b2*4)) > 1); |
| xeryus1206 | 0:d6f93f0e46d4 | 19 | b0=((counter-(b3*8)-(b2*4)-(b1*2)) > 0); |
| xeryus1206 | 0:d6f93f0e46d4 | 20 | |
| xeryus1206 | 0:d6f93f0e46d4 | 21 | bitthree = b3; |
| xeryus1206 | 0:d6f93f0e46d4 | 22 | bittwo = b2; |
| xeryus1206 | 0:d6f93f0e46d4 | 23 | bitone = b1; |
| xeryus1206 | 0:d6f93f0e46d4 | 24 | bitzero = b0; |
| xeryus1206 | 0:d6f93f0e46d4 | 25 | |
| xeryus1206 | 0:d6f93f0e46d4 | 26 | wait(0.5); |
| xeryus1206 | 0:d6f93f0e46d4 | 27 | } |
| xeryus1206 | 0:d6f93f0e46d4 | 28 | counter = 0; |
| xeryus1206 | 0:d6f93f0e46d4 | 29 | } |
| xeryus1206 | 0:d6f93f0e46d4 | 30 | } |
