Arduino Uno Reset Button Not Working

I am new to Arduino and I wanted to test stuff out.

I have an Arduino Uno R4 Wifi that is powered through the USB-C connector to my laptop. I wrote the most simple code to test out the reset button.

void setup() 
{
  pinMode(D0, OUTPUT);
  pinMode(D1, OUTPUT);
  analogWrite(D0, 255);
  analogWrite(D1, 0);
}

void loop() 
{}

However, even after I press the reset button, the voltage difference between pins D0 and D1 is 4.6V. Is there something I am missing about the reset button? I read that it is supposed to be equivalent to cutting power to the Arduino and then re-powering it, but it is not doing that.

Welcome to the forum

Your topic has been moved to the UNO R4 WiFi category of the forum

As to your question, how are you measuring the voltage on the pins ? I ask because a PWM output will only ever be at 0V or 5V as the output is PWM and is, therefore, either on or off

The compiler won't complain, but you cannot analogWrite to D0, D1.

Good spot. I had not noticed that mistake !

Thanks for clarifying. The feature I was looking for was something that un-uploads the code, which I thought the reset button does.

As you said, the setup function is re-run after the button is pressed. However, I found by pure accident that pressing the reset button twice does the exact thing I wanted, which was making voltage difference between the two pins become 0.

Which is it ? Remove the code or make the voltage difference 0V ?

Are they not the same thing? In any case, making the voltage difference go to 0 was my goal.

I guess that's so.
Using Pin 13, the 'HIGH' value has to be >= 128.
Why dW non-PWM pins?

It would have been helpful to have known that from the start. As a matter of interest why do you want to do this and why are you using analogWrite() with digital pins ?

I just copied an example code from a tutorial, which used analogWrite. I am using digitalWrite now.

As for why I wanted this feature is because I am using the Arduino to control a motor and I just wanted a way to quickly stop the motor.

That sounds like a job for a hardware solution

Use it to cut the motor power

I will look into it. Thank you.

The list that I posted is from the official webpage cheat sheet.
They aren't shown as being "PWM".
(I don't have a UNO R4 WIFI.)
Arduino UNO R4 WiFi Cheat Sheet | Arduino Documentation

But they chose to put Serial1 on pins 0 and 1 so it was not a hard a hard and fast decision

It does nobody any favours to hide or not to document that the R4 can do more than the R3. I would rather that the full facts were documented

There is nothing wrong with compatibility being one way.

2 Likes

Even odder, in some respects, ie the serial interfaces and the pins used, are not backwards compatible in any case and I believe that there are some difference with the analogue reference voltage but I am not sure what

Added to that, because of the different processors some long standing libraries do not work with the R4. although that situation is improving