![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Mircroprocessor revised code 9/22
Fork of m3pi_HelloWorld by
main.cpp@8:abc27ba9f8f3, 2014-09-18 (annotated)
- Committer:
- SpicedPork
- Date:
- Thu Sep 18 18:55:58 2014 +0000
- Revision:
- 8:abc27ba9f8f3
- Parent:
- 7:d0689e8f23bf
- Child:
- 9:b723c1cdaae4
rev
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
SpicedPork | 8:abc27ba9f8f3 | 1 | #include "mbed.h" |
SpicedPork | 8:abc27ba9f8f3 | 2 | #include "m3pi.h" |
SpicedPork | 8:abc27ba9f8f3 | 3 | |
SpicedPork | 8:abc27ba9f8f3 | 4 | m3pi m3pi; |
SpicedPork | 8:abc27ba9f8f3 | 5 | |
SpicedPork | 8:abc27ba9f8f3 | 6 | Timer stopwatch; |
SpicedPork | 8:abc27ba9f8f3 | 7 | DigitalOut myled(LED1); |
SpicedPork | 8:abc27ba9f8f3 | 8 | |
SpicedPork | 8:abc27ba9f8f3 | 9 | int main(){ |
SpicedPork | 8:abc27ba9f8f3 | 10 | |
SpicedPork | 8:abc27ba9f8f3 | 11 | int oldtime=0; |
SpicedPork | 8:abc27ba9f8f3 | 12 | |
SpicedPork | 8:abc27ba9f8f3 | 13 | m3pi.stop(); |
SpicedPork | 8:abc27ba9f8f3 | 14 | |
SpicedPork | 8:abc27ba9f8f3 | 15 | m3pi.locate(0,1); |
SpicedPork | 8:abc27ba9f8f3 | 16 | m3pi.printf("butts"); |
SpicedPork | 8:abc27ba9f8f3 | 17 | |
SpicedPork | 8:abc27ba9f8f3 | 18 | stopwatch.reset(); |
SpicedPork | 8:abc27ba9f8f3 | 19 | stopwatch.start(); |
SpicedPork | 8:abc27ba9f8f3 | 20 | |
SpicedPork | 8:abc27ba9f8f3 | 21 | while (1) { |
SpicedPork | 8:abc27ba9f8f3 | 22 | m3pi.locate(0,0); |
SpicedPork | 8:abc27ba9f8f3 | 23 | m3pi.printf("%i",stopwatch.read_ms()); |
SpicedPork | 8:abc27ba9f8f3 | 24 | if (stopwatch,read_ms()-oldtime>1000) { |
SpicedPork | 8:abc27ba9f8f3 | 25 | myled=!myled; |
SpicedPork | 8:abc27ba9f8f3 | 26 | oldtime=stopwatch.read_ms(); |
SpicedPork | 8:abc27ba9f8f3 | 27 | |
SpicedPork | 8:abc27ba9f8f3 | 28 | } |
SpicedPork | 8:abc27ba9f8f3 | 29 | } |
SpicedPork | 8:abc27ba9f8f3 | 30 | } |