Skip to main content

Fabien Bataille

Fabien Bataille's Public Library

  • The volatile keyword is added to the state variable, this causes the compiler to use RAM instead of a storage register
  • This is done because the storage register can be temporarily inaccurate if they are being modified by areas other than the main thread

  • int pin = 13;
     volatile int state = LOW;
     void setup()
       pinMode(pin, OUTPUT);
       attachInterrupt(0, blink, CHANGE);
     void loop()
       digitalWrite(pin, state);
     void blink()
       state = !state;
1 - 20 of 1684 Next › Last »
20 items/page

Diigo is about better ways to research, share and collaborate on information. Learn more »

Join Diigo