Skip to content

Instantly share code, notes, and snippets.

@LemonSec
Created December 8, 2023 17:49
Show Gist options
  • Save LemonSec/b62ca799d801aea733e7b97bbbd08f02 to your computer and use it in GitHub Desktop.
Save LemonSec/b62ca799d801aea733e7b97bbbd08f02 to your computer and use it in GitHub Desktop.
Crestron rave mode
#Creston rave mode
# instructions
1. Create a SIMPL Windows Program:
• Start by creating a new SIMPL Windows program file.
2. Add a Touch Panel or Button Interface:
• Add a touch panel or a control interface to your program. This is where you will place your “Rave Mode” button.
3. Add the SIMPL+ Module:
• Import the SIMPL+ module you created into your SIMPL Windows program.
4. Create “Rave Mode” Button:
• On your touch panel or control interface, create a button and label it “Rave Mode”.
5. Logic Tie-In:
• Link the “Rave Mode” button to the StartStop digital input of the SIMPL+ module. This will be the trigger for starting and stopping the rave mode.
6. Link Output Signals:
• Map the LightControl and PlayAudio digital outputs from the SIMPL+ module to the appropriate control system outputs that manage your lights and audio system.
Example Code Snippet for the “Rave Mode” Button:
Assuming you have the button in your touch panel interface:
// In SIMPL Windows
// Button: Rave Mode
// Digital Signal ID for Rave Mode Button: 1 (example ID)
// Link the button to the SIMPL+ module
// Assuming your SIMPL+ module is named 'RaveModeModule'
// Digital Input
RaveModeModule.StartStop -> TouchPanelOrControlInterface.RaveModeButton_fb
// Digital Output (to control lights and audio)
RaveModeModule.LightControl -> LightSystem.ControlInput
RaveModeModule.PlayAudio -> AudioSystem.PlayInput
##########################code}####}##}}}#######
#include "SIMPLDEF.H"
// Define the input and output interfaces
digital_input StartStop; // Digital input to start/stop the light toggling
digital_output LightControl; // Digital output to control the light
digital_output PlayAudio; // Digital output to control audio playback
// Variables
int IsRunning = 0; // Variable to track if the light toggling is active
// Function to toggle light
void ToggleLight()
{
while(IsRunning)
{
LightControl = !LightControl; // Toggle light state
Sleep(1); // Wait for 1 second (1000 milliseconds)
}
}
// Function to control audio
void ControlAudio()
{
if(IsRunning)
{
PlayAudio = 1; // Start playing audio
}
else
{
PlayAudio = 0; // Stop playing audio
}
}
// Event handler for the StartStop input
void StartStop_OnPush()
{
IsRunning = !IsRunning; // Toggle the running state
if(IsRunning)
{
ToggleLight(); // Start toggling the light
}
ControlAudio(); // Control audio playback based on the state
}
// Register event handlers
REGISTER_EVENT(StartStop, PUSH, StartStop_OnPush);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment