Attiny85 with DC motor and pushbutton

Dear Arduino community

I need some help please.
I am trying to program attiny85 with DC motor and pushbutton control and Arduino language. With breadboard, I use a pushbutton, dc motor, pot, transistor and resistors only. I am using this schematic (with additional resistor and pushbutton on pin 3) shown in the website below:

When I press on the pushbutton, I would like the dc motor to start running and when I press it again, dc motor should stop. When I press again, it should start again. When I press again, it should stop... and keep that same logic. I tried different codes but couldn't make work alone. When I try my code without the pushbutton, it works. However, when I add the pushbutton, it doesn't work anymore. If I use a led instead of the DC motor, it works.

Is there a way to program this please for attiny85 chip with dc motor?

Thank you

I moved your topic to an appropriate forum category @donga9.

In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

That is a terrible tutorial. I recommend to ignore that site.

The motor lacks the required inductive kick diode, so the transistor has probably been destroyed. The circuit also lacks the required decoupling capacitor (typically 100 nF) across the power pins of the ATtiny. Finally, breadboards are for low power logic circuits, and cannot handle motor currents. The tracks tend to burn.

Safe motor control circuit: