Currently, the max pwm value is hardcoded to 1023, but it could be different on different boards. This should be made flexible.