Allen Smith
/
firstTest
somme dumb test
main.cpp@1:ea80f6d915c1, 2013-09-04 (annotated)
- Committer:
- asmithmd1
- Date:
- Wed Sep 04 14:05:52 2013 +0000
- Revision:
- 1:ea80f6d915c1
- Parent:
- 0:a180484467e1
Just a test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
asmithmd1 | 0:a180484467e1 | 1 | #include "mbed.h" |
asmithmd1 | 0:a180484467e1 | 2 | |
asmithmd1 | 0:a180484467e1 | 3 | DigitalOut myled0(LED1); |
asmithmd1 | 0:a180484467e1 | 4 | DigitalOut myled1(LED2); |
asmithmd1 | 0:a180484467e1 | 5 | DigitalOut myled2(LED3); |
asmithmd1 | 0:a180484467e1 | 6 | DigitalOut myled3(LED4); |
asmithmd1 | 0:a180484467e1 | 7 | |
asmithmd1 | 1:ea80f6d915c1 | 8 | Serial pc(USBTX, USBRX); // tx, rx |
asmithmd1 | 1:ea80f6d915c1 | 9 | |
asmithmd1 | 0:a180484467e1 | 10 | int main() { |
asmithmd1 | 1:ea80f6d915c1 | 11 | int i = 0; |
asmithmd1 | 1:ea80f6d915c1 | 12 | char d; |
asmithmd1 | 1:ea80f6d915c1 | 13 | char buffer[128]; |
asmithmd1 | 1:ea80f6d915c1 | 14 | |
asmithmd1 | 0:a180484467e1 | 15 | while(1) { |
asmithmd1 | 1:ea80f6d915c1 | 16 | |
asmithmd1 | 1:ea80f6d915c1 | 17 | pc.printf("Hello World! %d \n\r", i); |
asmithmd1 | 1:ea80f6d915c1 | 18 | ++i; |
asmithmd1 | 1:ea80f6d915c1 | 19 | pc.gets(buffer, 4); |
asmithmd1 | 1:ea80f6d915c1 | 20 | pc.printf("I got '%s'\n", buffer); |
asmithmd1 | 1:ea80f6d915c1 | 21 | |
asmithmd1 | 0:a180484467e1 | 22 | myled0 = 1; |
asmithmd1 | 0:a180484467e1 | 23 | wait(0.1); |
asmithmd1 | 0:a180484467e1 | 24 | myled0 = 0; |
asmithmd1 | 0:a180484467e1 | 25 | wait(0.4); |
asmithmd1 | 0:a180484467e1 | 26 | |
asmithmd1 | 0:a180484467e1 | 27 | myled1 = 1; |
asmithmd1 | 0:a180484467e1 | 28 | wait(0.1); |
asmithmd1 | 0:a180484467e1 | 29 | myled1 = 0; |
asmithmd1 | 0:a180484467e1 | 30 | wait(0.4); |
asmithmd1 | 0:a180484467e1 | 31 | |
asmithmd1 | 0:a180484467e1 | 32 | myled2 = 1; |
asmithmd1 | 0:a180484467e1 | 33 | wait(0.1); |
asmithmd1 | 0:a180484467e1 | 34 | myled2 = 0; |
asmithmd1 | 0:a180484467e1 | 35 | wait(0.4); |
asmithmd1 | 0:a180484467e1 | 36 | |
asmithmd1 | 0:a180484467e1 | 37 | myled3 = 1; |
asmithmd1 | 0:a180484467e1 | 38 | wait(0.1); |
asmithmd1 | 0:a180484467e1 | 39 | myled3 = 0; |
asmithmd1 | 0:a180484467e1 | 40 | wait(0.4); |
asmithmd1 | 0:a180484467e1 | 41 | } |
asmithmd1 | 0:a180484467e1 | 42 | } |