Kinetic Sculpture  3.1
Software to Architecture for the Junior Kinetic Sculpture Project
 All Classes Files Functions Variables Macros Pages
Public Member Functions | Public Attributes | List of all members
Disc Class Reference

#include <Disc.h>

Public Member Functions

 Disc (Motor *attachedMotor)
 
void updateSpeed (float desiredRpm)
 
unsigned long getRotationsPerMinute ()
 
void setISR ()
 
void turnOnMotor ()
 
void turnOffMotor ()
 
void runDisc (double percent)
 
void runDiscRandomly ()
 
bool setMinMotorPercentage (byte percent)
 
bool setMaxMotorPercentage (byte percent)
 

Public Attributes

Motormotor
 

Detailed Description

Disc Class

Class that represents a disc (front or back disc) on the Kinetic Sculpture. Written by Wade Varesio & Courtney McIntosh 05/13/2019

Constructor & Destructor Documentation

Disc::Disc ( Motor attachedMotor)
inline

Constructor for a Disc Object

Constructs a Disc Object which represents the attached motor (and tachometer). Disc basically abstracts Motor to make controlling the Kinetic Sculpture more intuitive.

Parameters
attachedMotor- the motor object that runs the disc object

Member Function Documentation

void Disc::updateSpeed ( float  desiredRpm)
inline

Updates power sent to motors

Checks if the current RPM of each motor is greater or less than the desired RPM. If it is less, the motor is sped up, and if it is greater, the motor slows down is slowed down. It is also ensured that the motor will spin in the right direction by sending a positive or negative percentage when needed.

Parameters
desiredRpmthe desired RPM at which the motor would spin. Max desiredRpm is 30RPM
unsigned long Disc::getRotationsPerMinute ( )
inline

Get the rotations per minute

Returns
returns an unsigned long (a non-negative number that can include a fractional part)
void Disc::setISR ( )
inline

Set the interrupt service routine for the associated tachometer

void Disc::turnOnMotor ( )
inline

Forwards the call to turnOnMotor() to the appropriate Motor object using pointers

See Also
Motor::turnOnMotor()
void Disc::turnOffMotor ( )
inline

Forwards the call to turnOffMotor() to the appropriate Motor object using pointers

See Also
Motor::turnOffMotor()
void Disc::runDisc ( double  percent)
inline

Forwards the call to runMotor() to the appropriate Motor object using pointers

Parameters
percentthe percent at which you want the motor to run at
See Also
Motor::runMotor()
void Disc::runDiscRandomly ( )
inline

Run the disc in a random fashion.

Determines a random speed (RPM) and direction to run the disc at

bool Disc::setMinMotorPercentage ( byte  percent)
inline

Set the minimum percent nedded to run this discs motor at

Parameters
percentthe minimum percent needed to run the motor at. Must be non negative and less than 100 or the request will be ignored
Returns
true if percent is valid and the min usbale percentage was set, false otherwise
See Also
Motor::setMinMotorPercentage()
bool Disc::setMaxMotorPercentage ( byte  percent)
inline

Set the maximum amount of power the motor is allowed to run at

Parameters
percentthe new maximum amount of power the motor is allowed to run at. Must be greater than setMinimumUsablePercent but less than or equal to 100.
Returns
true if percent is valid and the motors max usable percent was set, false otherwise
See Also
Motor::setMaxMotorPercentage()

Member Data Documentation

Motor* Disc::motor

The Disc's attached motor


The documentation for this class was generated from the following file: