Serial print doesn't work with project. HELP.
i trying value of k printed on serial monitor can't work. if do, sin wave doesn't play.
how can fix , value of k shown on serial monitor along playing sin wave.
code: [select]
#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 button connected pin 2
attachinterrupt(button1, wave1select, rising); // interrupt attached button connected 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 fix , value of k shown on serial monitor along playing sin wave.
have tried adding "serial.begin(9600);" (or whatever baud rate set ide's serial to) in void setup?
it's unclear me you're doing in 2 loops. @ point k , used, k i+1. (edit: except when i==359, k==0.)
it's unclear me you're doing in 2 loops. @ point k , used, k i+1. (edit: except when i==359, k==0.)
Arduino Forum > Products > Arduino Due (Moderator: fabioc84) > Serial print doesn't work with project. HELP.
arduino
Comments
Post a Comment