I also tried something different, I used a MOSFET transistor and connected the DC motor to it. I used the Digital Output block, instead of the PWM block, to switch the MOSFET on and off manually. (I used it as an electronic switch)
When the MOSFET is on, the DC motor should get its full power and rotate wit its max speed. However, when I did so, the DC motor rotated slowly. Its speed was the same as when I used PWM block with 255 input value. This is expected because the value 255 means 100% duty cycle, which also means ON all the period. However, still it is not the max speed of the motor. I checked many times by connecting the DC motor directly to the source and by using Arduino code.
Now the question is: why does the DC motor rotate slowly when its driver (or MOSFET) is being switched (on and off) by either a PWM block or a digital output block? I'm really confused!
Thanks in advance.