Resetting Arduino Uno By Serial or when a method is finished

Hi, Been on the forum a while but decided to sign up today so this is my first question.

Is it possible to reset an arduino uno using a serial message?

if((inData == "RC") || (inData ==  "rc") || (inData == "Rc") || (inData == "rC"))
    {
     //Reset board?

     }

If I send the message through serial to the board is there anyway I can reset it? Thanks

Is it possible to reset an arduino uno using a serial message?

The ONLY way to reset the Arduino is to press the reset switch.

There are ways to sort of (but not really) reset the Arduino in software. The exact approach depends on exactly what you want to reset. Call setup() and start looping again? That needs one approach. Turn off all the attached hardware, and force a hard restart? That requires the reset switch. Perform a soft reset? Another approach, but one that depends on exactly what you mean by a soft reset.

You could initiate a watchdog reset on receipt of a message.

AWOL: You could initiate a watchdog reset on receipt of a message.

This would also be a good solution, could you also help me? I have never used watchdog

PaulS:

Is it possible to reset an arduino uno using a serial message?

The ONLY way to reset the Arduino is to press the reset switch.

There are ways to sort of (but not really) reset the Arduino in software. The exact approach depends on exactly what you want to reset. Call setup() and start looping again? That needs one approach. Turn off all the attached hardware, and force a hard restart? That requires the reset switch. Perform a soft reset? Another approach, but one that depends on exactly what you mean by a soft reset.

If i was able to get it to call setup() and start looping again that would be great. Could you point me in this direction?

If i was able to get it to call setup() and start looping again that would be great. Could you point me in this direction?

if(userWantsToRestart)
{
   setup();
   return;
}

PaulS:

If i was able to get it to call setup() and start looping again that would be great. Could you point me in this direction?

if(userWantsToRestart)
{
   setup();
   return;
}

Thats alot simplier than I thought, What about when I want to reset like plugging it in and out of the computer. Sometimes if it is running and there is a power cut once the computer reboots the com port is locked? I assume the only way to do this is to actually plug it in and out?

And just to note I am using Windows

Usually, when somebody asks how to reset an Arduino the truth is that it is not the best way to solve their underlying problem.

Karl447: Sometimes if it is running and there is a power cut once the computer reboots the com port is locked? I assume the only way to do this is to actually plug it in and out?

Is this the only reason you want to do the reset? The problem is probably that some other application on your PC is opening the serial (COM) port. This is something that mobile phone management applications sometimes do, so it would be worth investigating which application is causing the problem and then tackle that directly. If you have some other reason for wanting to reset the Arduino, I suggest you explain what it is and perhaps we can advise you how to solve it without doing a hard reset.

does the reset switch pull low or high?

if so, you could get the soldering iron out and do a hardware reset from a digital pin.