![](/media/cache/profiles/7ed334513e65f01deefba9e87e53ea94.jpg.50x50_q85.jpg)
Programa para testes
main.cpp@17:daa4ab0790ed, 2015-03-05 (annotated)
- Committer:
- mlucas82
- Date:
- Thu Mar 05 11:39:56 2015 +0000
- Revision:
- 17:daa4ab0790ed
- Parent:
- 15:544ab0319bc6
- Child:
- 18:fd0356641437
Implementadas fun??es de piscadas e pausas curtas e longas e implementado o SOS
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mlucas82 | 0:a6f65085b80e | 1 | #include "mbed.h" |
mlucas82 | 0:a6f65085b80e | 2 | |
mlucas82 | 0:a6f65085b80e | 3 | DigitalOut myled(LED1); |
mlucas82 | 0:a6f65085b80e | 4 | |
mlucas82 | 17:daa4ab0790ed | 5 | void pisca(float tempo) |
mlucas82 | 1:8c81337d6d2e | 6 | { |
mlucas82 | 1:8c81337d6d2e | 7 | myled = 1; |
mlucas82 | 17:daa4ab0790ed | 8 | wait(tempo); |
mlucas82 | 17:daa4ab0790ed | 9 | myled = 0; |
mlucas82 | 17:daa4ab0790ed | 10 | } |
mlucas82 | 17:daa4ab0790ed | 11 | |
mlucas82 | 17:daa4ab0790ed | 12 | void piscaCurto() |
mlucas82 | 17:daa4ab0790ed | 13 | { |
mlucas82 | 17:daa4ab0790ed | 14 | pisca(0.3); |
mlucas82 | 17:daa4ab0790ed | 15 | } |
mlucas82 | 17:daa4ab0790ed | 16 | |
mlucas82 | 17:daa4ab0790ed | 17 | void piscaLongo() |
mlucas82 | 17:daa4ab0790ed | 18 | { |
mlucas82 | 17:daa4ab0790ed | 19 | pisca(0.6); |
mlucas82 | 17:daa4ab0790ed | 20 | } |
mlucas82 | 17:daa4ab0790ed | 21 | |
mlucas82 | 17:daa4ab0790ed | 22 | void pausa(float tempo) |
mlucas82 | 17:daa4ab0790ed | 23 | { |
mlucas82 | 17:daa4ab0790ed | 24 | wait(tempo); |
mlucas82 | 17:daa4ab0790ed | 25 | } |
mlucas82 | 17:daa4ab0790ed | 26 | |
mlucas82 | 17:daa4ab0790ed | 27 | void pausaCurta() |
mlucas82 | 17:daa4ab0790ed | 28 | { |
mlucas82 | 17:daa4ab0790ed | 29 | pausa(0.3); |
mlucas82 | 17:daa4ab0790ed | 30 | } |
mlucas82 | 17:daa4ab0790ed | 31 | |
mlucas82 | 17:daa4ab0790ed | 32 | void pausaLonga() |
mlucas82 | 17:daa4ab0790ed | 33 | { |
mlucas82 | 17:daa4ab0790ed | 34 | pausa(0.6); |
mlucas82 | 1:8c81337d6d2e | 35 | } |
mlucas82 | 1:8c81337d6d2e | 36 | |
mlucas82 | 0:a6f65085b80e | 37 | int main() { |
mlucas82 | 0:a6f65085b80e | 38 | while(1) { |
mlucas82 | 17:daa4ab0790ed | 39 | piscaCurto(); |
mlucas82 | 17:daa4ab0790ed | 40 | pausaCurta(); |
mlucas82 | 17:daa4ab0790ed | 41 | piscaCurto(); |
mlucas82 | 17:daa4ab0790ed | 42 | pausaCurta(); |
mlucas82 | 17:daa4ab0790ed | 43 | piscaCurto(); |
mlucas82 | 17:daa4ab0790ed | 44 | |
mlucas82 | 17:daa4ab0790ed | 45 | pausaLonga(); |
mlucas82 | 17:daa4ab0790ed | 46 | |
mlucas82 | 17:daa4ab0790ed | 47 | piscaLongo(); |
mlucas82 | 17:daa4ab0790ed | 48 | pausaCurta(); |
mlucas82 | 17:daa4ab0790ed | 49 | piscaLongo(); |
mlucas82 | 17:daa4ab0790ed | 50 | pausaCurta(); |
mlucas82 | 17:daa4ab0790ed | 51 | piscaLongo(); |
mlucas82 | 17:daa4ab0790ed | 52 | |
mlucas82 | 17:daa4ab0790ed | 53 | pausaLonga(); |
mlucas82 | 17:daa4ab0790ed | 54 | |
mlucas82 | 17:daa4ab0790ed | 55 | piscaCurto(); |
mlucas82 | 17:daa4ab0790ed | 56 | pausaCurta(); |
mlucas82 | 17:daa4ab0790ed | 57 | piscaCurto(); |
mlucas82 | 17:daa4ab0790ed | 58 | pausaCurta(); |
mlucas82 | 17:daa4ab0790ed | 59 | piscaCurto(); |
mlucas82 | 17:daa4ab0790ed | 60 | |
mlucas82 | 17:daa4ab0790ed | 61 | wait(1); |
mlucas82 | 0:a6f65085b80e | 62 | } |
mlucas82 | 0:a6f65085b80e | 63 | } |
Marcos A. Lucas |
14:e3794e644d5b | 64 |