Skip to content

Spinner timer to find the last light lit in a sequence driven by the spinner #336

@Scottacus64

Description

@Scottacus64

The goal here was to have a spinner drive a sequence of lights and then figure out which light was the one lit by the last spin of the spinner. To do this a timer was set whose length was the same as the slowest spin of the spinner. This length will need to be determined by experimentation on a real spinner but for the purposes of this config it will be set at 5 seconds (because I'm using monitor for testing).

When the spinner switch is hit the timer starts and is set to restart each time the spinner switch is hit ("restart" both starts and restarts a timer). If the timer runs out then the spinner has stopped spinning and the value of the counter is the last light lit.

counters:
spinner_rotations:
count_events: s_spinner_active #spinner switch
count_complete_value: 7 #number of lights in the sequence
starting_count: 0
direction: up
persist_state: true # keep the last light lit from ball to ballin case the spinner tends to land on the same number
events_when_hit: advance_lane # "advance_lane" plays shows that drive the lights
reset_on_complete: true # allow the light sequence to circle back on itself
disable_on_complete: false # allow to run multiple times per ball

timers:
spinner_timer:
direction: down # count down from...
start_value: 5 # 5 to...
end_value: 0 # 0 at a rate of...
tick_interval: 500ms # 500ms for each tick
debug: true
control_events:
- action: restart # restart the timer..
event: s_spinner_active # each time the spinner switch is hit

show_player:
mode_base_started: base_lighting
advance_lane{count==1}: # if the event "advance_lane" is played and the count is "1" then...
1_on: play # play the show that lights the first light and turns off the last light
7_on: stop # stop the previous show
advance_lane{count==2}:
2_on: play
1_on: stop
advance_lane{count==3}:
3_on: play
2_on: stop
advance_lane{count==4}:
4_on: play
3_on: stop
advance_lane{count==5}:
5_on: play
4_on: stop
advance_lane{count==6}:
6_on: play
5_on: stop
advance_lane{count==7}:
7_on: play
6_on: stop

variable_player:
advance_lane{count<7}: # if the advance_lane counter is less than 7..
dice_pips: 1 # advance the player variable dice_pips by one so that it is not "7"
advance_lane{count==7}: # if the advance_lane counter is 7 then set the..
dice_pips: # player variable dice_pips to...
int: 7 # equal 7
action: set
timer_spinner_timer_complete{current_player.dice_pips==7}: #if the current player's dice_pips when the spinner stops is 7
score: 1000 #then payout 1000 points

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions