PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 line
570B

  1. #include <Bounce.h>
  2. #define BUTTON 2
  3. #define LED 13
  4. int ledValue = LOW;
  5. // This example changes the state of the LED everytime the button is pushed
  6. // Build the circuit indicated here: http://arduino.cc/en/Tutorial/Button
  7. Bounce bouncer = Bounce( BUTTON, 5 );
  8. void setup() {
  9. pinMode(BUTTON,INPUT);
  10. pinMode(LED,OUTPUT);
  11. }
  12. void loop() {
  13. if ( bouncer.update() ) {
  14. if ( bouncer.read() == HIGH) {
  15. if ( ledValue == LOW ) {
  16. ledValue = HIGH;
  17. } else {
  18. ledValue = LOW;
  19. }
  20. digitalWrite(LED,ledValue);
  21. }
  22. }
  23. }