Hi,
Code:
// network variables
// destination is to all nodes
char aux[0];
int counterProblem = 0;
void setup()
{
RTC.ON();
// 2011, dec, 19, sunday, 6 pm, 00 min, 00 sec
RTC.setTime( 2011, 12, 19, 2, 18, 0, 0 );
ACC.ON();
USB.begin();
counterProblem = 0;
}
void loop()
{
USB.print("counterProblem=");
USB.println(counterProblem);
sprintf(aux,"%d,%d,%d,temp:%d,bat:%d%c%c%c",
ACC.getX(), ACC.getY(), ACC.getZ(),
RTC.getTemperature(), PWR.getBatteryLevel(),'%','\r','\n');
USB.print("counterProblem=");
USB.println(counterProblem);
counterProblem++;
if (counterProblem > 10)
{
USB.println("counterProblem is > 10");
counterProblem = 0;
}
delay(1000);
}
The above code will print out the integer counterProblem at the beginning of the loop and after the sprintf function. The values printed will be 0 and 14000 respectively. Why is this happening?