This function sets the counter value of an encoder.
dcmotor.setEncoderPosition(pos)
pos - a integer value which represents counter value of an encoder (-1 billion to +1 billion)
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 counter value
dcmotor.setEncoderPosition(10000);
}
void loop() {
Serial.println(dcmotor.getEncoderPosition());
delay(100);
}