PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

37 行
690B

  1. /*
  2. MsTimer2 is a small and very easy to use library to interface Timer2 with
  3. humans. It's called MsTimer2 because it "hardcodes" a resolution of 1
  4. millisecond on timer2
  5. For Details see: http://www.arduino.cc/playground/Main/MsTimer2
  6. */
  7. #include <MsTimer2.h>
  8. // Switch on LED on and off each half second
  9. #if ARDUINO >= 100
  10. const int led_pin = LED_BUILTIN; // 1.0 built in LED pin var
  11. #else
  12. const int led_pin = 13; // default to pin 13
  13. #endif
  14. void flash()
  15. {
  16. static boolean output = HIGH;
  17. digitalWrite(led_pin, output);
  18. output = !output;
  19. }
  20. void setup()
  21. {
  22. pinMode(led_pin, OUTPUT);
  23. MsTimer2::set(500, flash); // 500ms period
  24. MsTimer2::start();
  25. }
  26. void loop()
  27. {
  28. }