title: arduino interrupt variable not working
body: <p>I am a beginner with arduino and I'm trying to make a sinus wave generator. Since I've recently found I can't put everything into main void loop, I'm trying to use interrupts. I have problem with changing variable inside of the interrupt (Delay), I don't know where's the mistake.
  Here is my code:</p>
  
  <pre><code>int sine256[]  = { //256 sin values from 0 to 2pi
  };
  
  int i = 0;
  int sensorPin = 7;  
  int outputPin = 6;
  volatile float Delay = 10000;
  
  
  void setup()
  {  
    Serial.begin(9600);
    pinMode(outputPin, OUTPUT);
    pinMode(sensorPin, INPUT); 
    attachInterrupt(digitalPinToInterrupt(sensorPin), freq, RISING);
  
  }
  void loop()
  {
    analogWrite(6,sine256[i]);
    i = i + 1;
    if(i == 256){
      i = 0; 
      } 
  
    Serial.println(Delay);
  
    delayMicroseconds(Delay);
  }
  
  void freq() {
    Delay = Delay/2;     
  }
  </code></pre>