Kinetic Sculpture: Extravaganza

Home

Current Objective: Make the Extravanganza of your Kinetic Sculpture

Requirements

  1. Cleanly format your code to maximize organization and readability like theĀ dpeaArduinoStyleGuide.
  2. Clarify the purpose of each function and variable through smartĀ naming.
  3. Use headers and comments as needed to enhance organization.

Global Variables for Velocity

  1. Copy and paste this code into the top of your global variables section:
  2.  
    const byte frontMotorDirectionPin = 15, frontMotorPwmPin = 11, frontMotorTachPin = 19;
    const byte backMotorDirectionPin = 14, backMotorPwmPin = 12, backMotorTachPin = 18;
    
  3. Next, we need three lines of object code, two that are very similar. I'll give you the first and the third lines, and you have to figure out the second one:
    1. DiscVelocityControl frontDisc(frontMotorDirectionPin, frontMotorPwmPin, frontMotorTachPin);
      
    2. For the second line, you just need to change the first line into the back disc instead of the front disc. Use logic, and you'll be able to figure it out.
    3. DiscVelocityControl discVelocities[] = {frontDisc, backDisc};
      
  4. Add the following global float arrays:
    1. Set discVelocityValue to have two 0s.
    2. Set discVelocityPrev to have two 0s.
    3. Set discVelocityNext to have two 0s.
    4. Set discVelocitySlope to have two 0s.
  5. Add the global byte variable index and initialize it to 0.
  6. Add the global unsigned long variable nextTransitionTime and initialize it to the sum of millis() and transitionDuration
  7. Replace dataIsIncoming with timeForNextTransition
  8. Add this line of code: extern DiscVelocityControl discVelocityControl[2];

Keep going, you're halfway there! If you have a wording question, or notice any errors, talk to Anna the senior.

Back

Next Page