sos2.ino 881 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include <Automaton.h>
  2. Atm_led dot, dash;
  3. Atm_timer stepTimer;
  4. Atm_step step;
  5. const int pin = 4;
  6. const int dotTime = 100;
  7. const int dashTime = 300;
  8. const int waitTime = 200;
  9. const int longwaitTime = 300;
  10. const int longerwaitTime = 1000;
  11. void setup() {
  12. // Define two leds (patterns)
  13. dot.begin( pin ).blink( dotTime, waitTime, 3 );
  14. dash.begin( pin ).blink( dashTime, waitTime, 3 );
  15. // Define a timer
  16. stepTimer.begin( 1700 ).repeat( ATM_COUNTER_OFF );
  17. // Define a step sequencer and link it to the leds we defined earlier
  18. step.begin()
  19. .onStep( 0, dot, Atm_led::EVT_BLINK )
  20. .onStep( 1, dash, Atm_led::EVT_BLINK )
  21. .onStep( 2, dot, Atm_led::EVT_BLINK );
  22. // Set up the timer to drive the step sequencer
  23. stepTimer.onTimer( step, Atm_step::EVT_STEP );
  24. // Start the timer
  25. stepTimer.start();
  26. }
  27. void loop() {
  28. automaton.run();
  29. }