26 motor = attachedMotor;
42 }
else if(desiredRpm < -30){
49 float desiredDiscRpm = desiredRpm;
50 long desiredTachRpm = desiredDiscRpm * 1250;
51 long desireMin = desiredTachRpm - 1000;
52 long desireMax = desiredTachRpm + 1000;
54 while (tachRpm > desireMax or tachRpm < desireMin){
62 if (desiredTachRpm > tachRpm){
65 else if(desiredTachRpm < tachRpm){
120 int randRpm = rand() %
MAX_RPM;
121 int randDir = pow(-1, rand() % 2);
123 updateSpeed(randRpm * randDir);
Motor * motor
Definition: Disc.h:16
#define MAX_RPM
Definition: Disc.h:6
unsigned long getRotationsPerMinute()
Definition: Disc.h:75
void runMotor(double percent)
Definition: Motor.h:60
bool setMinMotorPercentage(byte percent)
Definition: Disc.h:134
void setISR()
Definition: Disc.h:82
bool setMaxUsablePercent(byte percent)
Definition: Motor.h:219
void turnOnMotor()
Definition: Disc.h:91
void turnOffMotor()
Definition: Disc.h:100
void turnOnMotor()
Definition: Motor.h:101
Disc(Motor *attachedMotor)
Definition: Disc.h:25
void turnOffMotor()
Definition: Motor.h:94
void decreasePercentage(double step)
Definition: Motor.h:127
void updateSpeed(float desiredRpm)
Definition: Disc.h:39
void increasePercentage(double step)
Definition: Motor.h:112
double getDirection()
Definition: Motor.h:173
double getPercentage()
Definition: Motor.h:164
void setupMotor()
Definition: Motor.h:44
bool setMinimumUsablePercent(byte percent)
Definition: Motor.h:184
void runDisc(double percent)
Definition: Disc.h:110
bool setMaxMotorPercentage(byte percent)
Definition: Disc.h:146
void interruptServiceRoutine()
Definition: Motor.h:138
unsigned long getRotationsPerMinute()
Definition: Motor.h:148
void runDiscRandomly()
Definition: Disc.h:119