类和功能


类(Class)

为了使用此扩展板使用PHPoC Expansion数据库的ExpansionDCMotor

成员函数

ExpansionDCMotor class可使用的函数如下。

成员函数 说明
int getPID(void) get the product's ID
char *getName(void) get the product's name
ExpansionDCMotor(int sid, int port) create an instance of a motor port
setPolarity(int pol) set a PWM polarity
setDirection(int dir) set a direction of rotation
setPeriod(long period) set a PWM period
setWidth(long width) set a HIGH duration (a duty cycle)
setDecay(int decay) set decay mode
setEncoderPolarity(int pol) set a count direction of encoder
setEncoderPosition(long pos) set a counter value of encoder
setEncoderPSR(int psr) set a sampling count of encoder
getEncoderPosition(void) get a counter value of encoder
getEncoderPeriod(void) get a period of encoder output
setFilterFrequency(long freq) set a cut-off frequency of LPF
setFilterPNC(int pnc) set a noise counter of LPF
getFilterPNC(void) get a noise counter of LPF