I was wondering if you guys could help me solve an arduino Coding problem. I've simplified the code to highlight the issue that I'm having. I've created a program to read streaming serial data to an array. This array needs to be printed at a specific time interval, delays in this case are insufficient, and I have resorted to using timer.h which can be found here http://playground.arduino.cc/Code/Timer
. My intention was to read to an array of size index, and increment index. When index becomes a value of 80, it is supposed to save the the array (inData) to another array("prntfd"). ("prntfd") is printed every 5 seconds. In this I hoped to decouple the serial timing, and the print timing of a serial data array.
Unfortunately the code only prints "c", and a print line. The code is below. Any insights would be much appreciated
//Sketch feeds serial data to array (inData) of size (index).
//A timer library is then used to print the data every 5 seconds
//debugs: a,b,c are inserted at various parts of the code.
//Serial data from inChar should print every 5 seconds just after C.
//Include timer libraries and serial library
//set serial pins, serial feed array "inData" and its index "index"
static char prntfd;
int index = 0;
t.every(5000, takeReading);//set call time to function "take reading"
char inChar = nss.read();
if (index <(80))
inData[index++] = inChar;
inData[index] = '\0';
else if (index == 80)
inData == prntfd;
index = 0;