![](/media/cache/profiles/7ed334513e65f01deefba9e87e53ea94.jpg.50x50_q85.jpg)
Programa para testes
main.cpp@19:dc205bc94993, 2015-04-21 (annotated)
- Committer:
- mlucas82
- Date:
- Tue Apr 21 23:52:53 2015 +0000
- Revision:
- 19:dc205bc94993
- Parent:
- 18:fd0356641437
published
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 | 18:fd0356641437 | 5 | #define CURTO 0.3 |
mlucas82 | 18:fd0356641437 | 6 | #define LONGO 0.9 |
mlucas82 | 18:fd0356641437 | 7 | |
mlucas82 | 17:daa4ab0790ed | 8 | void pisca(float tempo) |
mlucas82 | 1:8c81337d6d2e | 9 | { |
mlucas82 | 1:8c81337d6d2e | 10 | myled = 1; |
mlucas82 | 17:daa4ab0790ed | 11 | wait(tempo); |
mlucas82 | 17:daa4ab0790ed | 12 | myled = 0; |
mlucas82 | 17:daa4ab0790ed | 13 | } |
mlucas82 | 17:daa4ab0790ed | 14 | |
mlucas82 | 17:daa4ab0790ed | 15 | void piscaCurto() |
mlucas82 | 17:daa4ab0790ed | 16 | { |
mlucas82 | 18:fd0356641437 | 17 | pisca(CURTO); |
mlucas82 | 17:daa4ab0790ed | 18 | } |
mlucas82 | 17:daa4ab0790ed | 19 | |
mlucas82 | 17:daa4ab0790ed | 20 | void piscaLongo() |
mlucas82 | 17:daa4ab0790ed | 21 | { |
mlucas82 | 18:fd0356641437 | 22 | pisca(LONGO); |
mlucas82 | 17:daa4ab0790ed | 23 | } |
mlucas82 | 17:daa4ab0790ed | 24 | |
mlucas82 | 17:daa4ab0790ed | 25 | void pausa(float tempo) |
mlucas82 | 17:daa4ab0790ed | 26 | { |
mlucas82 | 17:daa4ab0790ed | 27 | wait(tempo); |
mlucas82 | 17:daa4ab0790ed | 28 | } |
mlucas82 | 17:daa4ab0790ed | 29 | |
mlucas82 | 0:a6f65085b80e | 30 | int main() { |
mlucas82 | 19:dc205bc94993 | 31 | pausa(1); |
mlucas82 | 0:a6f65085b80e | 32 | while(1) { |
mlucas82 | 19:dc205bc94993 | 33 | printf("S\n"); |
mlucas82 | 17:daa4ab0790ed | 34 | piscaCurto(); |
mlucas82 | 18:fd0356641437 | 35 | pausa(CURTO); |
mlucas82 | 17:daa4ab0790ed | 36 | piscaCurto(); |
mlucas82 | 18:fd0356641437 | 37 | pausa(CURTO); |
mlucas82 | 17:daa4ab0790ed | 38 | piscaCurto(); |
mlucas82 | 17:daa4ab0790ed | 39 | |
mlucas82 | 18:fd0356641437 | 40 | pausa(1); |
mlucas82 | 17:daa4ab0790ed | 41 | |
mlucas82 | 19:dc205bc94993 | 42 | printf("O\n"); |
mlucas82 | 17:daa4ab0790ed | 43 | piscaLongo(); |
mlucas82 | 18:fd0356641437 | 44 | pausa(CURTO); |
mlucas82 | 17:daa4ab0790ed | 45 | piscaLongo(); |
mlucas82 | 18:fd0356641437 | 46 | pausa(CURTO); |
mlucas82 | 17:daa4ab0790ed | 47 | piscaLongo(); |
mlucas82 | 17:daa4ab0790ed | 48 | |
mlucas82 | 18:fd0356641437 | 49 | pausa(1); |
mlucas82 | 17:daa4ab0790ed | 50 | |
mlucas82 | 19:dc205bc94993 | 51 | printf("S\n"); |
mlucas82 | 17:daa4ab0790ed | 52 | piscaCurto(); |
mlucas82 | 18:fd0356641437 | 53 | pausa(CURTO); |
mlucas82 | 17:daa4ab0790ed | 54 | piscaCurto(); |
mlucas82 | 18:fd0356641437 | 55 | pausa(CURTO); |
mlucas82 | 17:daa4ab0790ed | 56 | piscaCurto(); |
mlucas82 | 17:daa4ab0790ed | 57 | |
mlucas82 | 17:daa4ab0790ed | 58 | wait(1); |
mlucas82 | 0:a6f65085b80e | 59 | } |
mlucas82 | 0:a6f65085b80e | 60 | } |
Marcos A. Lucas |
14:e3794e644d5b | 61 |