This function sets the decay mode.
dcmotor.setDecay(decay)
decay - a integer value which represents the decay mode
decay | mode |
---|---|
0 | slow decay mode |
otherwise | fast decay mode (default) |
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);
}
void loop() {
// fast decay mode
dcmotor.setDecay(1);
dcmotor.setWidth(10000);
dcmotor.setWidth(0);
delay(5000);
// slow decay mode
dcmotor.setDecay(0);
dcmotor.setWidth(10000);
dcmotor.setWidth(0);
delay(5000);
}