Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import machine
def setup(temps, thresh):
pump_pin = machine.Pin(14, machine.Pin.OUT)
warn_led = machine.Pin(17, machine.Pin.OUT)
pump_on = lambda: pump_pin.off()
pump_off = lambda: pump_pin.on()
warn_on = lambda: warn_led.off()
warn_off = lambda: warn_led.on()
def s_cold_enter():
pump_off()
warn_off()
def s_heatUp1_enter():
pump_on()
warn_off()
def s_heatUp2_enter():
pump_off()
warn_off()
def s_hot_enter():
pump_off()
warn_off()
def s_toHot_enter():
pump_on()
warn_on()
def s_muchToHot_enter():
pump_on()
warn_on()
s_cold = ep_statemachine.state("cold", initial=True, entry_action=s_cold_enter) #1
s_heatUp1 = ep_statemachine.state("heatUp1", entry_action=s_heatUp1_enter) #2
s_heatUp2 = ep_statemachine.state("heatUp2", entry_action=s_heatUp2_enter) #3
s_hot = ep_statemachine.state("hot", entry_action=s_hot_enter) #4
s_toHot = ep_statemachine.state("toHot", entry_action=s_toHot_enter) #5
s_muchToHot = ep_statemachine.state("muchToHot", entry_action=s_muchToHot_enter) #6
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment