This function sets the sampling count of an encoder.
dcmotor.setEncoderPSR(psr)
psr - a integer value which represents sampling count of an encoder (1 ~ 64)
none
#include <PhpocExpansion.h>
#include <Phpoc.h>
byte spcId = 1;
ExpansionDCMotor dcmotor(spcId, 1);
void setup() {
Serial.begin(9600);
while(!Serial)
;
Phpoc.begin(PF_LOG_SPI | PF_LOG_NET);
Expansion.begin();
Serial.println(dcmotor.getPID());
Serial.println(dcmotor.getName());
dcmotor.setPeriod(10000);
dcmotor.setWidth(3000);
// set sampling count
dcmotor.setEncoderPSR(16);
}
void loop() {
Serial.println(dcmotor.getEncoderPosition());
delay(100);
}