text: Hi
  Im trying to control a few things via pwm. 2 of 3 are working but i cant get motor speed control to work.
  I have a 12v mains power going into a 5v bec. Which supplys arduino.
  I supply the power + to motor and setup pwm on digital pin 9. Set fast pwm. And analogwrite to pin with pwm duty rate. Say 50 percent. This is outputted to a n channel mosfet which switches the earth side of the motor.
  On other pwm pins i get 5v output. But on the motor pin i get half of 5v for 50 percent. Etc. I tried different pins but no joy.
  More i think about it. Must be code but im not sure and cant get my head round it
  Iv attached some code. Pretty new to coding
  float mapf(float x, float in_min, float in_max, float out_min, float out_max) {
  x = constrain(x, in_min, in_max);
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
  }
  void burn_fan() {
  int percent_map = mapf(fan_speed, 0, 100, 0, 255);
  analogWrite(burn_fan_pin, percent_map);
  }