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:
- 30:293ee760d357
- Parent:
- 29:559eb2164488
- Child:
- 31:7637861f4dc7
--- a/main.cpp Tue Jun 12 10:43:43 2018 +0000 +++ b/main.cpp Tue Jun 12 10:47:59 2018 +0000 @@ -265,9 +265,10 @@ * *@switchId - (1-4)The ID of the switch we want to flip *@times - The number of times we want to send the command +*@activate - True if the switch is going to be activated. False if it needs to go back to rest position. * **/ -void flipSwitch(int switchId, int times){ +void flipSwitch(int switchId, int times, bool activate=true){ unsigned int SWBflip = SWBidle; //IDLE - Flip last activated SW. @@ -289,7 +290,12 @@ } //Security measure not to burn the switch. - if(times <=5){ DCC_send_command(SWBaddress,SWBflip,times); } + if(times <=5){ + DCC_send_command(SWBaddress,SWBflip,times); //Activating switch + if(!activate){ + DCC_send_command(SWBaddress,SWBidle,times); //Sending IDLE to flip back. + } + } }