The reason why the PWM module was developed was to have a way to generate an analog output voltage using an external RC filter circuit. This was in order to control the fan of the ceiling-mounted air-conditioning units, whose fan controller accepts a voltage of between 0 and 10 volts.
An interesting feature of this module is that it has its own binary protocol to allow for remote control, which is how the air-conditioning service can directly control the fan speeds via the ceiling-mounted nodes:
#include "base_module.h" #include <HardwarePWM.h> class PwmModule { static HardwarePWM* hw_pwm; static Vector<int> duty; static uint8 pinNum; static Timer timer; static uint8* pins; public: static bool initialize(); static bool start(); static ...