attiny tilt switch pwm

ok ive updated my project with your suggestion and now nothing works. any ideas?

jremington:
The diagram is incomplete and incorrect.

It doesn't seem to show a motor power supply, and it has the motor connected to the base terminal of the transistor. You need a base resistor.

Try something like this, but use a separate power supply for the motor, and connect the grounds.