In this lecture, I want to show you a couple of ways to use software to reset your ISP 32 in addition
to the hardware reset down by pressing the reset button on the device itself.
If you have a look at the micro python documentation into the machine module and reset related functions
right here, you'll see that there are a couple of ways of doing such an operation.
The first one is just calling the reset method.
And this is going to basically have the same effect as if you were pressing the external reset button
is going to reset the device.
The second method is to use the soft reset, which is going to simply reset the interpreter.
It will clear up memory, reset the python heap, as you can see here.
But the most important difference between these two is that the soft reset will not disconnect you from
USB or wi fi connections.
I don't have a script to show you, so we'll do the demonstration and the experimentation in the show
on the command line.
So let's begin first by importing machine machine module and I'm going to attempt a soft recidivist.
Do soft research, copy and paste that into a show and you get a soft reboot.
If I tried to to bring up the reset caused by calling the reset cause method copy and paste it in here,
you'll see that machine is not defined, which means that the ram was wiped out.
And I will read the import machine and check on the reset course and then no one comes up, which there's
a link here.
So you can see the constants that are used by reset.
Cause of this number corresponds to one hard reset, which is the bit weird.
I wonder if these particular information here is actually correct.
What I'll do is I'm going to leave this aside for now and press the reset button to do a hard reset
called the power on reset and import machine again and check the reset course again.
You see, no one took this is probably correct.
Zero one.
Yeah, hard reset.
I'm going to try out the soft reset method.
To see what happens with that so recent, so you can see this is a software c.p.u reset as opposed to
a power on reset and kind of import machine and check on the reset codes.
And this time it gives me two, which means, you know, one to probably like a WTT reset or watchdog
reset, which OK.
Yep.
This looks right now.
It's a last experiment.
I'm going to go back into the first type of reset, the soft reset and see if that gives me a different
idea.
So I do a soft reset.
Syndicate says a soft reboot and import machine and reset course, this time it's too.
So as you can see, when I do a soft reset, it seems like the actual reset course is not properly reported,
then it would be whatever caused the device to reset prior to my soft reset.
So I guess this is a bug.
So what that tells me is that the soft reset does not actually report itself correctly when you use
the reset course method.
So that's something to keep in mind when you're using these methods in your programming.
But in any case, these two methods.
So reset and soft reset, provide your programmatic way to reset your device with needed.