Transistor doesn't control motor's speed

I'm learning transistors. This is a nice tutorial that I've used LINK. The only change I've made is I put 1k ohm between pin out and of arduino and transistor (I've also tried it without resistor). It supposed to control speed based on output of the pin. What's happening is for values 0-127 there's nothing and for values 128-255 motor turns on and spins randomly (probably because current from wall PSU is not even). I'm using the same TIP120 transistor as in the tutorial and 9V 1A PSU (I don't think that the power is the problem).

Why make people link to an other site to see what you might be doing.
Show us in a schematic and a picture your circuit.
Also, attach your sketch.

That tutorial is very bad and is NOT RECOMMENDED.

It suggests to connect a transistor base to the Arduino output without a current-limiting resistor, which can destroy the Arduino.

It also suggests, in the first experiment, to use a motor without a flyback diode. That can destroy the transistor as well.

While I was posting the picture I realized that my arduino pin was pin 2 which is not PWM. I changed it to pin 3 and it works fine now.

jremington:
That tutorial is very bad and is NOT RECOMMENDED.

It suggests to connect a transistor base to the Arduino output without a current-limiting resistor, which can destroy the Arduino.

It also suggests, in the first experiment, to use a motor without a flyback diode. That can destroy the transistor as well.

I used two diodes (as one of the pictures shows) and resistor.