Counter Element
The counter element is used to implement a periodic software counter.
Properties
The following properties can be changed for the counter element:
Name
The name of the element.
Initial Value
The initial counter value. Must be an integer.
Rollover Value
The value at which the counter will rollover and reset.
This behaves similar to a modulo, where the counter will never actually reach this value. After the counter is incremented or decremented, if the new value is equal to the rollover value, the counter will be reset and the counter reset
trigger will be executed.
Reset to Initial Value
When enabled, the counter will reset to the initial value when a rollover occurs. Otherwise, the counter will reset to 0.
Counter Rollover
When enabled, the counter will rollover. If disabled, the counter will continue to increment up to its maximum 32 bit signed range.
Triggers
The following triggers are available to execute events from within the counter element:
Triggered
Execute an event when the source element connected to the counter triggers.
Counter Reset
Execute an event when the counter resets.
Value Incremented
Execute an event when the counter is incremented. This will pass the current value of the counter.
Value Decremented
Execute an event when the counter is decremented. This will pass the current value of the counter.
Value Retrieved
Execute an event when the current counter value is retrieved. This will pass the current value of the counter.
Abilities
The following abilities are available for the counter element when its source element triggers:
Trigger
Trigger the element(s) that follow the counter element.
Increment Value
Increment the current value of the counter by one.
Decrement Value
Decrement the current value of the counter by one.
Retrieve Value
Retrieve the current value of the counter.
Element Resources
Atmosphere includes a selection of resources for users of all levels that demonstrate using the counter element.
Demo Projects
To view the counter element used within a project, click the demo’s name to open the project in Atmosphere and see how the element is set up.
Name | Hardware | Description |
---|---|---|
Counter Clock ESP32 Demo | ESP32 | The counter element is used within this demo project by counting seconds and minutes based off a 200ms interval. |
Counter Element Arduino Demo | Arduino Mega | The counter element is used within this demo project by incrementing and decrementing values and printing them on the debug console. |