Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 32:e5b732fb8e65
- Parent:
- 31:7637861f4dc7
- Child:
- 33:24ce12dec157
--- a/main.cpp Tue Jun 12 12:12:00 2018 +0000 +++ b/main.cpp Tue Jun 12 12:15:05 2018 +0000 @@ -71,7 +71,8 @@ //typical out of box default engine DCC address is 3 (at least for Bachmann trains) //Note: A DCC controller can reprogram the address whenever needed -const unsigned int DCCaddress = 0x01; //Address for train 1 +const unsigned int DCCaddressDR = 0x01; //Address for train 1 DARK-RED +const unsigned int DCCaddressLR = 0x03; //Address for train 3 LIGHT-RED //01DCSSSS for speed, D is direction (fwd=1 and rev=0), C is speed(SSSSC) LSB const unsigned int DCCinst_forward = 0x68; //forward half speed @@ -367,9 +368,9 @@ initialize_mcp(); //mcp initialization for interrupts before train running //Train light routine to start running - DCC_send_command(DCCaddress,DCC_func_lighton,200); // turn light on full - DCC_send_command(DCCaddress,DCC_func_dimlight,400); //dim light - DCC_send_command(DCCaddress,DCC_func_lighton,200); //light full again + DCC_send_command(DCCaddressDR,DCC_func_lighton,200); // turn light on full + DCC_send_command(DCCaddressDR,DCC_func_dimlight,400); //dim light + DCC_send_command(DCCaddressDR,DCC_func_lighton,200); //light full again //LED3 Shows start of route + LCD notif led3 = 1; // Entering the while @@ -385,11 +386,12 @@ lcd.cls(); lcd.printf("All aboard\n mind the gap"); - DCC_send_command(DCCaddress,DCCinst_stop,400); + DCC_send_command(DCCaddressDR,DCCinst_stop,400); lcd.cls(); }else{ - DCC_send_command(DCCaddress,DCCinst_forward,1); // Forward half speed train address 3 + DCC_send_command(DCCaddressDR,DCCinst_forward,1); // Forward half speed train addres DARK-RED + DCC_send_command(DCCaddressLR,DCCinst_forward,1); // Forward half speed train address LIGHT-RED } } }