Christopher Peirs
/
nightrider
A simple, "Hello World" type of program, which uses all 4 leds.
main.cpp@0:3afccafa6090, 2012-10-24 (annotated)
- Committer:
- cpeirs
- Date:
- Wed Oct 24 13:55:05 2012 +0000
- Revision:
- 0:3afccafa6090
NightRider is a simple "Hello World" type of program.; First build
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cpeirs | 0:3afccafa6090 | 1 | #include "mbed.h" |
cpeirs | 0:3afccafa6090 | 2 | |
cpeirs | 0:3afccafa6090 | 3 | DigitalOut myled1(LED1); |
cpeirs | 0:3afccafa6090 | 4 | DigitalOut myled2(LED2); |
cpeirs | 0:3afccafa6090 | 5 | DigitalOut myled3(LED3); |
cpeirs | 0:3afccafa6090 | 6 | DigitalOut myled4(LED4); |
cpeirs | 0:3afccafa6090 | 7 | |
cpeirs | 0:3afccafa6090 | 8 | //LocalFileSystem local("local"); |
cpeirs | 0:3afccafa6090 | 9 | |
cpeirs | 0:3afccafa6090 | 10 | long i = 0; |
cpeirs | 0:3afccafa6090 | 11 | |
cpeirs | 0:3afccafa6090 | 12 | int main() |
cpeirs | 0:3afccafa6090 | 13 | { |
cpeirs | 0:3afccafa6090 | 14 | |
cpeirs | 0:3afccafa6090 | 15 | |
cpeirs | 0:3afccafa6090 | 16 | while (1) |
cpeirs | 0:3afccafa6090 | 17 | { |
cpeirs | 0:3afccafa6090 | 18 | //FILE *fp = fopen("/local/test.txt", "a"); |
cpeirs | 0:3afccafa6090 | 19 | myled1 = 1; |
cpeirs | 0:3afccafa6090 | 20 | wait(0.05); |
cpeirs | 0:3afccafa6090 | 21 | myled1 = 0; |
cpeirs | 0:3afccafa6090 | 22 | myled2 = 1; |
cpeirs | 0:3afccafa6090 | 23 | wait(0.05); |
cpeirs | 0:3afccafa6090 | 24 | myled2 = 0; |
cpeirs | 0:3afccafa6090 | 25 | myled3 = 1; |
cpeirs | 0:3afccafa6090 | 26 | wait(0.05); |
cpeirs | 0:3afccafa6090 | 27 | myled3 = 0; |
cpeirs | 0:3afccafa6090 | 28 | myled4 = 1; |
cpeirs | 0:3afccafa6090 | 29 | wait(0.2); |
cpeirs | 0:3afccafa6090 | 30 | myled4 = 0; |
cpeirs | 0:3afccafa6090 | 31 | myled3 = 1; |
cpeirs | 0:3afccafa6090 | 32 | wait(0.05); |
cpeirs | 0:3afccafa6090 | 33 | myled3 = 0; |
cpeirs | 0:3afccafa6090 | 34 | myled2 = 1; |
cpeirs | 0:3afccafa6090 | 35 | wait(0.05); |
cpeirs | 0:3afccafa6090 | 36 | myled2 = 0; |
cpeirs | 0:3afccafa6090 | 37 | myled1 = 1; |
cpeirs | 0:3afccafa6090 | 38 | wait(0.05); |
cpeirs | 0:3afccafa6090 | 39 | myled1 = 0; |
cpeirs | 0:3afccafa6090 | 40 | wait(0.5); |
cpeirs | 0:3afccafa6090 | 41 | printf("nightrider loop %i\n\r", i); |
cpeirs | 0:3afccafa6090 | 42 | i++; |
cpeirs | 0:3afccafa6090 | 43 | //fclose(fp); |
cpeirs | 0:3afccafa6090 | 44 | //wait(5); |
cpeirs | 0:3afccafa6090 | 45 | |
cpeirs | 0:3afccafa6090 | 46 | } |
cpeirs | 0:3afccafa6090 | 47 | } |