Can any one tell me why I get to see output to the serial monitor with my UNO but not with my Lenardo using this sketch?
Baan_Baan.ino (806 Bytes)
Can any one tell me why I get to see output to the serial monitor with my UNO but not with my Lenardo using this sketch?
Baan_Baan.ino (806 Bytes)
That should work. On the Leonardo and Micro, the hardware serial is Serial1 but the USB serial is Serial.
Just a comment, but attaching and detaching is an "expensive" operation on the Arduino and it WILL drop interrupts. The better way to do this is to suspend the interrupts, grab a copy of the variable and then re-enable the interrupts. This way if an interrupt comes in during that time that the interrupts are suspended, it will be handled by your interrupt handler, just a little late.
while (j < 51)
{
delay(500);
Serial.print(" Time ");
Serial.print(j);
Serial.print(" ");
noInterrupts(); //suspend interrupts while we grab a copy of the variable
unsigned long temp = time[j];
interrupts() //re-enable interrupts
Serial.println(temp);
j++;
}
Thanks MorganS, found my problem interrupt "0" is not the same on the two boards UNO pin 1 and Leanardo pin 3 should read the manual first..