Serial print doesn't work with project. HELP.

I am trying to get the value of k to be printed on the Serial monitor but I can't get it to work. If I do, then the sin wave doesn't play.

#include "Waveforms.h"

const int button0 = 2, button1 = 3;
volatile int wave0 = 0, freq1= 0;

void setup() {
  analogWriteResolution(12);
  attachInterrupt(button0, wave0Select, RISING);  // Interrupt attached to the button connected to pin 2
  attachInterrupt(button1, wave1Select, RISING);  // Interrupt attached to the button connected to pin 3

}
void loop() {
 int k=wave0;
 k = k*5;
 for(int i=0; i<360; i++) {
 k++;
 if(k>= 360) k=0;
 analogWrite(DAC1, sinTable[i]);
 
 analogWrite(DAC0, sinTable[k]);
 delayMicroseconds(frequencyTable[freq1]);
 }
Serial.println(k);

}

void wave0Select() {
  wave0++;
  if(wave0 == 72)
    wave0 = 0;
}

void wave1Select() {
  freq1++;
  if(freq1 == 5)
    freq1 = 0;
}

How can I fix this and get the value of k to be shown on the Serial monitor along with playing the sin wave.

Waveforms.h (2.6 KB)

Have you tried adding a "Serial.begin(9600);" (or whatever baud rate you set the IDE's serial to) in void setup?

It's unclear to me what you're doing in the two loops. At the point where k and i are used, k will always just be i+1. (Edit: Except when i==359, then k==0.)