How to use STM32 on board button to power on a motor on Arduino

I have this STM32F030F4P6 board
41kTuifz4WL.AC_SY350

It has a small reset button, and I want to use it in order to power on a little 3.3V DC motor that should take the energy from board itself but only when the button stay pushed in order to make it spin only till the button remains pressed and stop on release.
The motor is a simple DC motor with just wires for V+ and V-.
The 3V3 pin of the board is already used as Vin for a sensor and the only 3V3 pin free are those of the 2 programming interfaces.

How should do this with Arduino IDE?

I don't know well this board, but if the button really a RESET button, you won't achieve what you want.
Why do you not connect the button to the board GPIO pin and than read it in the your sketch?

This doesn't make sense. Why don't you just connect the motor to a power source though an external pushbutton if that's all you need?

Because the microcontroller has to intervene in other tasks according the button status as well, isn't meant to just make the motor spinning. This is the point of my question but not the only purpose of the whole project.

Are you using the reset button in your project, is I understood correctly? Did you desoldered it?

Why don't you want to use external button?

If could be used on board button it would be better I would save a button and related wiring keeping the project more compact taking advantage of a button that practically I have never used, in case this is not possible I will check alternatives...

(I'm not talking about desoldering the on board button but a way to use it directly)

pressing this button causes the controller to reboot - is this what you want?

No.
I want that pressing this button it does only the task described, I don't need it works as reset button.

But it works as reset ALREADY!
So to prevent the reboot you have to desolder it.

So are you saying that to reset this button works interrupting the microcontroller power... Ok, got it, so I cannot use this button.
I hoped it acted at logical level and could have been assigned to different purpose from software.

In this case I have no other choice to use an external button.

no, I did not say that

It acted as logical, but can't assigned anything else.

Ok.

With external button what is the proper way to do this? It is needed a resistor?

The same way as with any other board

Ok but could I use the programmer 3V3 pin to power it? (As I have said the normal 3V3 pins are already used)

You should power your motor from power source, not from board's pin. 3v3 pins on the board are works via voltage regulator and can provide very limited current.
You can try to power the motor from the board, but it will almost certainly work unstable and you will have to change the connections later

It's a very small motor it doesn't need much current, and I would prefer to power it directly from board.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.