What the program should do: A. Switch on procedure 1. Bridge switch on default position at 0° 2. Sensor on bridge to test for locomotive on the bridge a. If there is locomotive on the bridge i. Display - "Bridge is occupied" ii. Switch on Amber LED's on bridge iii. Move the bridge to 0° b. If bridge empty (and not at 0°) i. Switch on Amber LED's on bridge ii. Display - "Bridge is moving to 0°" iii. Move the bridge to 0° c. If locomotive is moved onto the bridge i. Switch on flashing Amber LED's on bridge ii. Display - Bridge is occupied D. If there is a locomotive inside the loco and the loco is selected i. Switch on flashing Amber LED's in front of the sched ii. Display - Loco sched is occupied E. If there is a locomotive inside the loco i. Switch on Amber LED's in front of the sched B. Operational procedure 1. Select a number on the keypad a. Key selections if key = 0 to move the bridge to 0° if key = 1 to move the bridge to 115° if key = 2 to move the bridge to 85° if key = 3 to move the bridge to 55° if key = 4 to move the bridge to 25° if key = 5 to move the bridge to 345° if key = 6 to move the bridge to 315° if key = 7 to move the bridge to 285° if key = 8 to move the bridge to 255° if key = 9 to move the bridge to 180° if key = A Invalid key if key = B Invalid key if key = C Confirmation key if key = D Invalid key if key = * Invalid key if key = # Invalid key General: The bridge can either be moved directly to 180° from any position or to 0° from any position. BUT - the front end of the bridge have to stay at the closest point to the scheds, except when it is turned 180° Output to be displayed on the LCD: tft.setTextSize(2); tft.setTextColor(BLACK); tft.setCursor(0, 0); tft.fillScreen(WHITE); tft.println("--------------------------"); // Static line 1 tft.println(" Select Loco by pressing "); // Static line 2 tft.println(" a number on the Keypad "); // Static line 3 tft.println(" and C to confirm. "); // Static line 3 tft.println("--------------------------"); // Static line 1 tft.println(" Press 9 to turn to 180d "); // Static line 7 tft.println(" Press 0 to turn to 0d "); // Static line 8 tft.println("--------------------------"); // Static line 1 If Key Value = 1+C = move bridge (0°) to loco 1 etc.... (To force the front end of the bridge to rotate.) Clear Display tft.println("--------------------------"); // Static line 1 tft.println(" Loco in sched X Selected "); // Variable line 1 tft.println(" PRESS C TO CONFIRM "); // Pressing C will activate the stepper motor and switch on the amber LED's tft.println("--------------------------"); // Static line 1 If Key Value = 9+C = move bridge (0° to 180°) to loco 1 etc.... (To force the front end of the bridge to rotate.) Clear Display tft.println("--------------------------"); // Static line 1 tft.println("Bridge turn 180d selected "); // Variable line 2 tft.println(" PRESS C TO CONFIRM "); // Pressing C will activate the stepper motor and switch on the amber LED's tft.println("--------------------------"); // Static line 1 If Key Value = 0+C = move bridge to (0°) to loco 1 etc.... (To force the front end of the bridge to rotate.) tft.println("--------------------------"); // Static line 1 tft.println("Bridge move to 0d selected"); // Variable line 3 // This will turn the turntable back to 0° tft.println(" PRESS C TO CONFIRM "); // Pressing C will activate the stepper motor and switch on the amber LED's tft.println("--------------------------"); // Static line 1 Clear Display tft.println("--------------------------"); // Static line 1 tft.println("Standby bridge are moving "); // Flashing RED while stepper motor are turning tft.println(" Bridge turned to Loco X "); // To be displayed after the stepper motor is turned depending on degrees OR tft.println(" Bridge turned 180d / 0d "); // To be displayed after the stepper motor is turned 180° tft.println("--------------------------"); // Static line 1 /* HARDWARE USED */ /* Mega 2560 */ /* 2.4" TFTtft Shield */ /* 4 X 4 Keypad on Pins 22, 24, 26, 28, 30, 32, 34, 36 */ /* Stepper Motor on Pins 38, 40, 42, 44 */ /* 2 x Yellow LED's on Pins 46 and 48 */ Used on Bridge /* 2 x IRA Motion Sensors on Pins 50 and 52 */ Used on Bridge /* + 2 x IRA Motion Sensors on Pins x and x per Locosched */ NOT YET Implemented Pin Layout TFT Shield Fixed Keypad Pins 22 - 36 (equal pins) Stepper motor shield Pins 38 - 44 (equal pins) Yellow LED's Pins 46 - 48 (equal pins) InfraRed (IRA) Sensors Pins 50 and 52 Green LED's Pins 49 - 51 (un-equal pins) IRA for scheds might have to make use of digital pins Other sketches that needs integration into LCDenKeyPad_Reg (keypad control file): Stepper_Motor_Beheer.ino.txt - The stepper motor control file TurnTableManage_Keypad_Stepper_InfraRed_LEDs.txt - the ultimate final document TurnTableManage_Keypad_Stepper_InfraRed_LEDs.txt - the overview document. Stepper motor control panel with keypad.ino.txt (New file)