sos3.ino 859 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include <Automaton.h>
  2. Atm_led led[3];
  3. Atm_timer timer[3];
  4. const int pin = 4;
  5. const int dotTime = 100;
  6. const int dashTime = 300;
  7. const int waitTime = 200;
  8. const int longwaitTime = 300;
  9. const int longerwaitTime = 1000;
  10. void setup() {
  11. led[0].begin( pin )
  12. .blink( dotTime, waitTime, 3 )
  13. .onFinish( timer[0], Atm_timer::EVT_START );
  14. timer[0].begin( longwaitTime )
  15. .onTimer( led[1], Atm_led::EVT_BLINK );
  16. led[1].begin( pin )
  17. .blink( dashTime, waitTime, 3 )
  18. .onFinish( timer[1], Atm_timer::EVT_START );
  19. timer[1].begin( longwaitTime )
  20. .onTimer( led[2], Atm_led::EVT_BLINK );
  21. led[2].begin( pin )
  22. .blink( dotTime, waitTime, 3 )
  23. .onFinish( timer[2], Atm_timer::EVT_START );
  24. timer[2].begin( longerwaitTime )
  25. .onTimer( led[0], Atm_led::EVT_BLINK );
  26. led[0].start();
  27. }
  28. void loop() {
  29. automaton.run();
  30. }