Table 3.
Code variable and pin definitions for microcontrollers
| Variable | Definition | Pin |
|---|---|---|
| Part 1. Defined pins for main microcontroller | ||
| redLED0 | LED 1 | 34 |
| grnLED0 | 36 | |
| bluLED0 | 37 | |
| redLED1 | LED 2 | 38 |
| grnLED1 | 40 | |
| bluLED1 | 41 | |
| redLED2 | LED 3 | 42 |
| grnLED2 | 44 | |
| bluLED2 | 45 | |
| redLED3 | LED 4 | 46 |
| grnLED3 | 48 | |
| bluLED3 | 49 | |
| redLED4 | LED 5 | 50 |
| grnLED4 | 52 | |
| bluLED4 | 53 | |
| dirPin | Stepper motor | 26 |
| pulPin | 28 | |
| interruptPin0 | Receives sensor 1 output | 3 |
| interruptPin1 | Receives sensor 2 output | 18 |
| interruptPin2 | Receives sensor 3 output | 19 |
| interruptPin3 | Receives sensor 4 output | 20 |
| interruptPin4 | Receives sensor 5 output | 21 |
| startButton1Pin | Start pushbutton | 24 |
| cycleButtonPin | Cycle pushbutton | 22 |
| interruptKillPin | Emergency stop pushbutton | 2 |
| radiusPin | Toggle switch (for radius size) | 23 |
| Part 2. Defined variables for main microcontroller (Arduino MEGA) | ||
| startTime | Represents time after ramping sequence begins | |
| endTime0 | Time after mouse 1 falls | |
| endTime1 | Time after mouse 2 falls | |
| endTime2 | Time after mouse 3 falls | |
| endTime3 | Time after mouse 4 falls | |
| endTime4 | Time after mouse 5 falls | |
| elapsedTimeProgress | Used to represent present time throughout the program (used for equations) | |
| elapsedTime0 | Time mouse 1 spend on the rod from ramping program start to when it falls (endTime0-startTime) | |
| elapsedTime1 | Time mouse 2 spend on the rod from ramping program start to when it falls (endTime0-startTime) | |
| elapsedTime2 | Time mouse 3 spend on the rod from ramping program start to when it falls (endTime0-startTime) | |
| elapsedTime3 | Time mouse 4 spend on the rod from ramping program start to when it falls (endTime0-startTime) | |
| elapseedTime4 | Time mouse 5 spend on the rod from ramping program start to when it falls (endTime0-startTime) | |
| mode | Variable used to represent what ramping program (case) is selected | |
| delayTMillis | Variable for delay time between each impulse sent to stepper motor (in milliseconds) | |
| delayTMicros | Variable for delay time between each impulse sent to stepper motor (in microseconds) | |
| previousState | Variable for cycle button programming | |
| startButtonState | Start button | |
| mouse0Fell | Variable used for switch case logic | |
| mouse1Fell | Variable used for switch case logic | |
| mouse2Fell | Variable used for switch case logic | |
| mouse3Fell | Variable used for switch case logic | |
| mouse4Fell | Variable used for switch case logic | |
| mouse0Done | Variable used for switch case logic | |
| mouse1Done | Variable used for switch case logic | |
| mouse2Done | Variable used for switch case logic | |
| mouse3Done | Variable used for switch case logic | |
| mouse4Done | Variable used for switch case logic | |
| killButtonState | Emergency state button variable | |
| radiusFactor | Used to adjust equations for rods of different diameter | |
| radiusSwitchState | For toggle switch logic | |
| loopCount | For pushbutton logic | |
| Part 3. Defined pins and variables for secondary microcontroller (Arduino UNO) | ||
| currentVolts0 | Calculated volts from sensor 1 based on raw data sent to microcontroller | |
| currentVolts1 | Calculated volts from sensor 2 based on raw data sent to microcontroller | |
| currentVolts2 | Calculated volts from sensor 3 based on raw data sent to microcontroller | |
| currentVolts3 | Calculated volts from sensor 4 based on raw data sent to microcontroller | |
| currentVolts4 | Calculated volts from sensor 5 based on raw data sent to microcontroller | |
| previousVolts0 | Volts from previous data reading | |
| previousVolts1 | Volts from previous data reading | |
| previousVolts2 | Volts from previous data reading | |
| previousVolts3 | Volts from previous data reading | |
| previousVolts4 | Volts from previous data reading | |
| newVolts0 | Volts from sensor 1 after passed through digital lowpass filter | |
| newVolts1 | Volts from sensor 1 after passed through digital lowpass filter | |
| newVolts2 | Volts from sensor 1 after passed through digital lowpass filter | |
| newVolts3 | Volts from sensor 1 after passed through digital lowpass filter | |
| newVolts4 | Volts from sensor 1 after passed through digital lowpass filter | |
| a | Value for digital low pass filter | |
| pin 2 | Output for sensor 1 | |
| pin 3 | Output for sensor 2 | |
| pin 4 | Output for sensor 3 | |
| pin 5 | Output for sensor 4 | |
| pin 6 | Output for sensor 5 |