Hi,
I'm trying to use the PWM output of the microbit to control a fan. I have a simple transistor circuit to drive the fan, and the pin0 output is connected to the base of the transistor via a resistor. i have verified that the circuit works by using pin0.write_digital(1) - the fan duly turns.
However I wanted to use the PWM and using pwm to control the speed. Using pin0.write_analog(x) with x varying from 0 to 1023. With any settting of x I get no output measured on the pin. I am using a DVM so I reasoned that the PWM might be too fast for it to register, so I used set_analog_period(1000) reasoning that would set the on/off period to 1S so the DVM could track it. Still nothing.
HAS anyone successfully used the PWM on microbit micropython?
Many thanks in advance
Difficulty using write_analog()
Re: Difficulty using write_analog()
I'm using PWM on the microbit all the time to control hobby servos -- with the frequency set to 50Hz and duty between ~11 and ~70 it work fine. Are you doing anything else in that code?