Railway Challenge
/
challenge
Uncommenting of part that allow supercaps to charge up from the batteries
rtc.cpp@30:a04afea230fb, 2022-06-15 (annotated)
- Committer:
- jamesmcildowietfl
- Date:
- Wed Jun 15 11:33:56 2022 +0000
- Revision:
- 30:a04afea230fb
- Parent:
- 0:4788e1df7b55
Forgot to add light pins to header, done now ;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rwcjoliver | 0:4788e1df7b55 | 1 | #include <mbed.h> |
rwcjoliver | 0:4788e1df7b55 | 2 | #include "definitions.h" |
rwcjoliver | 0:4788e1df7b55 | 3 | //#include "remoteControl.h" // Enable if you want error sent to remote |
rwcjoliver | 0:4788e1df7b55 | 4 | #include "rtc.h" |
rwcjoliver | 0:4788e1df7b55 | 5 | #include "motor.h" |
rwcjoliver | 0:4788e1df7b55 | 6 | // |
rwcjoliver | 0:4788e1df7b55 | 7 | RoundTrainCircuit::RoundTrainCircuit( |
rwcjoliver | 0:4788e1df7b55 | 8 | DigitalIn rtc_1, |
rwcjoliver | 0:4788e1df7b55 | 9 | DigitalIn rtc_2, |
rwcjoliver | 0:4788e1df7b55 | 10 | DigitalIn rtc_3, |
rwcjoliver | 0:4788e1df7b55 | 11 | DigitalIn rtc_4, |
rwcjoliver | 0:4788e1df7b55 | 12 | DigitalIn rtc_5, |
rwcjoliver | 0:4788e1df7b55 | 13 | DigitalIn rtc_6, |
rwcjoliver | 0:4788e1df7b55 | 14 | DigitalIn rtc_7, |
rwcjoliver | 0:4788e1df7b55 | 15 | DigitalIn rtc_override) : |
rwcjoliver | 0:4788e1df7b55 | 16 | |
rwcjoliver | 0:4788e1df7b55 | 17 | deadman(rtc_1), |
rwcjoliver | 0:4788e1df7b55 | 18 | emergencyButtonLeft(rtc_2), |
rwcjoliver | 0:4788e1df7b55 | 19 | emergencyButtonRight(rtc_3), |
rwcjoliver | 0:4788e1df7b55 | 20 | heatDetector(rtc_4), |
rwcjoliver | 0:4788e1df7b55 | 21 | driverCord(rtc_5), |
rwcjoliver | 0:4788e1df7b55 | 22 | superCapOverVoltage(rtc_6), |
rwcjoliver | 0:4788e1df7b55 | 23 | spare(rtc_7), |
rwcjoliver | 0:4788e1df7b55 | 24 | override(rtc_override) |
rwcjoliver | 0:4788e1df7b55 | 25 | { |
rwcjoliver | 0:4788e1df7b55 | 26 | |
rwcjoliver | 0:4788e1df7b55 | 27 | } |
rwcjoliver | 0:4788e1df7b55 | 28 | |
rwcjoliver | 0:4788e1df7b55 | 29 | void RoundTrainCircuit::getTriggerCause() { |
rwcjoliver | 0:4788e1df7b55 | 30 | |
rwcjoliver | 0:4788e1df7b55 | 31 | if (deadman == 1) { |
rwcjoliver | 0:4788e1df7b55 | 32 | pc.printf("Deadman Switch Triggered\r\n"); |
rwcjoliver | 0:4788e1df7b55 | 33 | // DigitalOut footswitchM1(PD_4); |
rwcjoliver | 0:4788e1df7b55 | 34 | // DigitalOut seatM1(PD_5); |
rwcjoliver | 0:4788e1df7b55 | 35 | } |
rwcjoliver | 0:4788e1df7b55 | 36 | |
rwcjoliver | 0:4788e1df7b55 | 37 | if (emergencyButtonLeft == 1) { |
rwcjoliver | 0:4788e1df7b55 | 38 | pc.printf("Left Emergency Button Operated\r\n"); |
rwcjoliver | 0:4788e1df7b55 | 39 | } |
rwcjoliver | 0:4788e1df7b55 | 40 | |
rwcjoliver | 0:4788e1df7b55 | 41 | if (emergencyButtonRight == 1) { |
rwcjoliver | 0:4788e1df7b55 | 42 | pc.printf("Right Emergency Button Operated\r\n"); |
rwcjoliver | 0:4788e1df7b55 | 43 | } |
rwcjoliver | 0:4788e1df7b55 | 44 | |
rwcjoliver | 0:4788e1df7b55 | 45 | |
rwcjoliver | 0:4788e1df7b55 | 46 | if (heatDetector == 1) { |
rwcjoliver | 0:4788e1df7b55 | 47 | pc.printf("Heat Detector Triggered\r\n"); |
rwcjoliver | 0:4788e1df7b55 | 48 | } |
rwcjoliver | 0:4788e1df7b55 | 49 | |
rwcjoliver | 0:4788e1df7b55 | 50 | if (driverCord == 1) { |
rwcjoliver | 0:4788e1df7b55 | 51 | pc.printf("Driver Cord Released\r\n"); |
rwcjoliver | 0:4788e1df7b55 | 52 | } |
rwcjoliver | 0:4788e1df7b55 | 53 | |
rwcjoliver | 0:4788e1df7b55 | 54 | if (superCapOverVoltage == 1) { |
rwcjoliver | 0:4788e1df7b55 | 55 | pc.printf("Super Cap Reached Dangerous Levels\r\n"); |
rwcjoliver | 0:4788e1df7b55 | 56 | } |
rwcjoliver | 0:4788e1df7b55 | 57 | |
rwcjoliver | 0:4788e1df7b55 | 58 | if (spare == 1) { |
rwcjoliver | 0:4788e1df7b55 | 59 | pc.printf("Spare Input Triggered\r\n"); |
rwcjoliver | 0:4788e1df7b55 | 60 | } |
rwcjoliver | 0:4788e1df7b55 | 61 | } |