Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 8 months ago.
else if
hi I have code my programme but there is an error that I appreciate anybody helps me. It says that 'else' need a statement while i have put the statement there. here is the code:
else { lcd.clear(); lcd.refresh(); time_t seconds = time(NULL); // get current time // format time into a string (time and date) strftime(buffer1, 14 , "%X ", localtime(&seconds)); strftime(buffer3, 14 , "%D ", localtime(&seconds)); // print over serial // serial.printf("Time = %s\n",buffer1); sprintf(buffer2," %s",buffer1); lcd.printString(buffer2,0,2); lcd.printString(buffer3,0,3); if (setTimeFlag) { // if updated time has been sent setTimeFlag = 0; // clear flag setTime(); // update time } //wait(0.2); // stops the screen from flashing }
Edit by 0xc0170: please use '<<code>>
<</code>>' syntax for code snippets, thanks
what's before else { ?
posted by Martin Kojtal 11 Jan 2015there were 2 'if' i changed them to 'while' and removed the else and it works but doesn't show another variable. I am using mbed NXP LPC1768 wit TMP102 and a screen. now the error is that it doesnt show the temperature.thanks
posted by Mahmood Parsi 11 Jan 2015