sos1.ino 722 B

12345678910111213141516171819202122232425262728293031323334
  1. #include <Automaton.h>
  2. Atm_led led;
  3. const int pin = 4;
  4. const int dotTime = 100;
  5. const int dashTime = 300;
  6. const int waitTime = 200;
  7. const int longwaitTime = 500;
  8. const int longerwaitTime = 1000;
  9. void setup() {
  10. led.begin( pin );
  11. }
  12. void loop() {
  13. // Set the led to blink 3 times and trigger it
  14. led.blink( dotTime, waitTime, 3 ).start();
  15. // Loop until the blinking has finished
  16. while ( led.cycle().state() );
  17. // Cycle idly for a while
  18. led.cycle( longwaitTime );
  19. led.blink( dashTime, waitTime, 3 ).start();
  20. while ( led.cycle().state() );
  21. led.cycle( longwaitTime );
  22. led.blink( dotTime, waitTime, 3 ).start();
  23. while ( led.cycle().state() );
  24. led.cycle( longerwaitTime );
  25. }