Skip to content

Instantly share code, notes, and snippets.

@mentisy
Last active March 21, 2023 23:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mentisy/aef278ad81767c3e15e70b7a0347732f to your computer and use it in GitHub Desktop.
Save mentisy/aef278ad81767c3e15e70b7a0347732f to your computer and use it in GitHub Desktop.
Example of commented code
///////////////////////////////////////
// Change state of water for toilet
//
// Parameter `State`:
// - 0: Open
// - 1: Close
// - 2: Toggle? Or reverify state?
///////////////////////////////////////
Global Function SetWaterWC (State As Long)
WaterProcesBusy[2].Lock()
Select State
Case 0
Cell01_Relay_EnableWater_WC.Open()
Cell01_Relay_EnableWater_WC_FB.Open()
Case 1
Cell01_Relay_EnableWater_WC.Close()
Cell01_Relay_EnableWater_WC_FB.Close()
Case 2
If Cell01_Relay_EnableWater_WC.IsClosed() Then
Cell01_Relay_EnableWater_WC.Close()
Cell01_Relay_EnableWater_WC_FB.Close()
Else
Cell01_Relay_EnableWater_WC.Open()
Cell01_Relay_EnableWater_WC_FB.Open()
End If
End Select
WaterProcesBusy[1].Lock()
End Function
<?php
/**
* Change state of water for toilet
*
* @param int $state 0: Open, 1: Close, 2: Toggle
* @return void
*/
public function SetWaterWC(int $state)
{
switch ($state) {
case 0: echo "open";
case 1: echo "close";
case 2: echo "toggle?";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment