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.
8 years, 1 month ago.
is there any software reset command for nucleo l152re
int main() { int i = 0; float time; pin_up.mode(PullDown); pin_down.mode(PullDown); pin_start.mode(PullDown); pin_delay.mode(PullDown); pin_reset.mode(PullDown); if(pin_reset==1){ NVIC_SystemReset(); //...................................where should i put this to reset my system anytime } pin_start.rise(&startRun); lcd.cls(); lcd.locate(3,0); lcd.printf("READY"); wait(1); lcd.cls(); lcd.locate(3,0); lcd.printf("SET TIME"); do{ if(pin_up==1) {i= i++; wait(0.1); if (i>200) i=200; time = i; if(i<4){ lcd.cls(); lcd.locate(1,0); lcd.printf("Time= %2.2f mn", time*15); } else{ lcd.cls(); lcd.locate(1,0); lcd.printf("Time= %1.2f Hr", time*15/60); } } else if(pin_down==1){ i=i--; wait(0.1); if( i<0) i=0; time = i; if(i<4){ lcd.cls(); lcd.locate(1,0); lcd.printf("Time= %1.2f mn", time*15); } else{ lcd.cls(); lcd.locate(1,0); lcd.printf("Time= %1.2f Hr",time*15/60); } } } while(pin_start==0); Quarters = i; //Initial selected number of quarters if(runtimeleft > 0){ startRun(); // call to (re)start engine run) } else{ pin_start.rise(&startRun); }// just wait for keypress while(1); } // just wait for keypress
Question relating to:
1 Answer
8 years, 1 month ago.
If you want to reset the board everytime a button is pressed, it makes more sense to connect it to the reset pin.
But besides that, use an InterruptIn, and it will interrupt your program to reset it.