Railway Challenge / Mbed 2 deprecated challenge

Dependencies:   mbed millis

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers rtc.cpp Source File

rtc.cpp

00001 #include <mbed.h>
00002 #include "definitions.h"
00003 //#include "remoteControl.h"    // Enable if you want error sent to remote
00004 #include "rtc.h"
00005 #include "motor.h"
00006 //
00007 RoundTrainCircuit::RoundTrainCircuit(
00008                             DigitalIn rtc_1, 
00009                             DigitalIn rtc_2,
00010                             DigitalIn rtc_3,
00011                             DigitalIn rtc_4,
00012                             DigitalIn rtc_5,
00013                             DigitalIn rtc_6,
00014                             DigitalIn rtc_7,
00015                             DigitalIn rtc_override) :
00016                             
00017                             deadman(rtc_1),
00018                             emergencyButtonLeft(rtc_2),
00019                             emergencyButtonRight(rtc_3),
00020                             heatDetector(rtc_4),
00021                             driverCord(rtc_5),
00022                             superCapOverVoltage(rtc_6),
00023                             spare(rtc_7),
00024                             override(rtc_override)
00025                             {
00026 
00027 }
00028 
00029 void RoundTrainCircuit::getTriggerCause() {
00030 
00031     if (deadman == 1) {
00032         pc.printf("Deadman Switch Triggered\r\n");
00033 //        DigitalOut footswitchM1(PD_4);
00034 //        DigitalOut seatM1(PD_5);
00035     }
00036     
00037     if (emergencyButtonLeft == 1) {
00038         pc.printf("Left Emergency Button Operated\r\n");
00039     }
00040     
00041     if (emergencyButtonRight == 1) {
00042         pc.printf("Right Emergency Button Operated\r\n");
00043     }
00044     
00045     
00046     if (heatDetector == 1) {
00047         pc.printf("Heat Detector Triggered\r\n");
00048     }
00049     
00050     if (driverCord == 1) {
00051         pc.printf("Driver Cord Released\r\n");
00052     }
00053     
00054     if (superCapOverVoltage == 1) {
00055         pc.printf("Super Cap Reached Dangerous Levels\r\n");
00056     }
00057     
00058     if (spare == 1) {
00059         pc.printf("Spare Input Triggered\r\n");
00060     }
00061 }