My program checks on a button status, when press will set the variable printStatus =1
In my loop program, printStatus is checked and if is true, will invoke the printing routine.
After printing, the next statement printStatus =0 will set the variable back to 0 so no further printing until the button is press again.
When ever it prints, it always print twice (i.e. the printing is repeated two time)
Where ever I place the printStatus = 0 , it always prints twice
Not sure what have I missed out
Its running on the DUE
The printing routine here:-
//Printing the logTime of the Dayrun
void printLogStatus()
{
printer.print("Day Job Started on");
printer.write(10);
printer.print("Date: ");
printer.print(logdayOfMonth, DEC);
printer.print("-");
printer.print(logmonth, DEC);
printer.print("-20");
printer.print(logyear, DEC);
printer.print (" Time = ");
printer.print(loghour, DEC);
// convert the byte variable to a decimal number when displayed
printer.print(":");
if (logminute<10)
{
printer.print("0");
}
printer.print(logminute, DEC);
printer.print(":");
if (logsecond<10)
{
printer.print("0");
}
printer.print(logsecond, DEC);
printer.print(" ");
printer.write(10);
printer.write(10);
printer.write(10);
}
The loop routine here:
void loop()
{
pulsecount();
startprg();
printingButton();
if (printStatus == true){
printLogStatus();
printStatus=0;
}
}