 double interrupt_callback_time = (double) (1.0 / INT_FREQ);
 
 // use volatile for shared variables
-volatile unsigned int step = 0; // increment on interrupts
-volatile double time = 0; // increment on interrupts
+volatile unsigned int step = 0;
+volatile double time = 0;
 volatile double debug;
 
-// Objects
 IntervalTimer myTimer; // init Teensy timer
-asymmetry::ATrianglewave wave;
+asymmetry::ATrianglewave wave1;
+asymmetry::ATrianglewave wave2;
+asymmetry::ATrianglewave *pwave;
 
 void setup() {
   analogWriteResolution(12); // 12bit = 4096 levels (max is 13 bit)

  pinMode(ledPin, OUTPUT);
  pinMode(outPin, OUTPUT);

  wave.init(20);
  wave.compute();
  
  Serial.begin(115200);
  Serial.println("serial on");

// play value on analog out pin
void play_level(void) { 

  // toggle waves
  if (step >= INT_FREQ * 2) {
    if (pwave == &wave1) {
      pwave = &wave2;
      debug = 1;
    } else {
      pwave = &wave1;
      debug = 2;
    }
    step = 0;
  }
  
  if (time >= pwave->getPeriod()) {
    time = time - wave1.getPeriod();
  }

  double val = pwave->approx(time) * 2000 + 2000; // help with dc offset
  analogWrite(outPin, val);

  /* debug = val; */
  
  time = time + interrupt_callback_time;
  step++;
