Jump to content
c4forums | The Control4 Community

Got any handy tips to share?


jfh

Recommended Posts

When I started with HE, I was having a hard time keeping track of what code was where and what the logic was.

Four things helped tremendously:

1) creating a variable called "Comment" that I use to document logic/code as part of the code.

2) move any significant code into a macro and call the macro from the trigger event.

3) define variables (usually Boolean or string) to track desired states or define sources/targets that can be used in a macro to define function consistent between rooms/sources (for example, I have a Music button on a keypad in every zone that cycles through the same selections. The event code just defines the location specific variable(s) and then calls a Music Menu macro)

4) relying on timers more than delays, especially in cases where you may want to dynamically change the amount of time (kitchen lights don't go off as quickly during dinner time)

I wish C4 supported true subroutines so you could use the contents of a variable in an actual command, but macros with nested ?if statements is the next best thing.

Anyone have other tips to share on making programming easier?

Link to comment
Share on other sites


When I started with HE, I was having a hard time keeping track of what code was where and what the logic was.

Four things helped tremendously:

1) creating a variable called "Comment" that I use to document logic/code as part of the code.

2) move any significant code into a macro and call the macro from the trigger event.

3) define variables (usually Boolean or string) to track desired states or define sources/targets that can be used in a macro to define function consistent between rooms/sources (for example, I have a Music button on a keypad in every zone that cycles through the same selections. The event code just defines the location specific variable(s) and then calls a Music Menu macro)

4) relying on timers more than delays, especially in cases where you may want to dynamically change the amount of time (kitchen lights don't go off as quickly during dinner time)

I wish C4 supported true subroutines so you could use the contents of a variable in an actual command, but macros with nested ?if statements is the next best thing.

Anyone have other tips to share on making programming easier?

There are several threads - they are probably a year or so old now - where this was attempted before. You will enjoy them though if you hunt for them.

There are LOTs of cool tips and tricks.

Bill

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...