Not sure if I can help much, but it sounds like you have the PWM part working, That's probably what's making the motor beep. PWM can do that. You might need to change the figures in the part of the code that sets the PWM ratio. The PWM frequency needed varies with different motors & it's usually trial and error to get it exactly right.
You should probably post your sketch on this forum so more experienced eyes can look at it
Im new, and only have an arduino on order, but The question that comes to my mind is whether your DC motor has specs, and if so if the motor accepts or can run off 5v.
The high pitch squeal could be eminating from the coil being underdriven and unable to turn the rotor.
Just a thought and attempt at being helpful in my first post!
absoultly, i did all of thing you say to me.
(i'm just edit pintMode(PWM_PIN, OUTPUT) out for simplify code.
in my sketch, pinmode function was written.)
leave all of my cicuit and change dc motor to LED, it works very well.
(external power supply, directional switch such that.)