PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 3 gadiem
1234567891011121314151617181920212223242526272829303132
  1. #include <Bounce.h>
  2. // This code turns a led on/off through a debounced button
  3. // Build the circuit indicated here: http://arduino.cc/en/Tutorial/Button
  4. #define BUTTON 2
  5. #define LED 13
  6. // Instantiate a Bounce object with a 5 millisecond debounce time
  7. Bounce bouncer = Bounce( BUTTON,5 );
  8. void setup() {
  9. pinMode(BUTTON,INPUT);
  10. pinMode(LED,OUTPUT);
  11. }
  12. void loop() {
  13. // Update the debouncer
  14. bouncer.update ( );
  15. // Get the update value
  16. int value = bouncer.read();
  17. // Turn on or off the LED
  18. if ( value == HIGH) {
  19. digitalWrite(LED, HIGH );
  20. } else {
  21. digitalWrite(LED, LOW );
  22. }
  23. }