Hi
i am trying to run this program, however after uploading it
i do not get anything on the serial monitor. it remains blank.
what could be the reason ?
i tried to see if the interrupt was getting triggered somehow, but doesn't seem that way.
here is the code
edit : i forgot to add, the programs gets uploaded without any issues.
/*
IR Capture
Copyright 2012, all rights reserved.
James M. Eli
1/14/2012
project parts:
(1) arduino 16MHz
(1) 38KHz IR receiver
(1) breadboard
(3) wires
IR - Arduino
SIG - D2
GND - GND
VCC - VCC
*/
//definitions
#define IN_PIN 2
#define MAX_CAPTURE 584 // Line number 1
//globals
uint32_t now, start, capture[MAX_CAPTURE];
volatile bool flag_complete;
uint16_t i; // Line number 2 uint8_t to uint16_t Key point of RAWBUF. uint8_t maximum range 255
void setup() {
flag_complete = false;
start = 0;
now = 0;
i = 0;
Serial.begin(9600);
Serial.print("Ready to capture.");
attachInterrupt(0, IRInterrupt, CHANGE);
}
//interrupt fires on ir event (rise/fall)
void IRInterrupt() {
Serial.print("entered interrupt");
now = micros();
capture[i++] = now - start;
start = now;
if (i >= MAX_CAPTURE) {
detachInterrupt(0);
flag_complete = true;
}
}
void loop() {
while (1) {
if (flag_complete) {
for (i=0; i < MAX_CAPTURE; i++) {
Serial.println(capture[i]);
//Serial.print(",");
flag_complete = false;
}
}
}
}