Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Oct 6, 2023
1 parent 722cc95 commit 647f250
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions pioreactor/utils/pwm.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,18 @@ def __init__(self, pin: GpioPin, active_high=True, initial_value: float = 0.0, f
super().__init__(pwm_channel, hz=frequency)
self._value = initial_value

if initial_value:
self.on()

def close(self):
self.stop()
super().close()

def on(self):
self.change_duty_cycle(1.0)
self._value = 1.0
self.start(self._value * 100)

def off(self):
self.change_duty_cycle(0.0)
self.change_duty_cycle(0.0 * 100)
self._value = 0.0

def toggle(self):
if self.value:
if self.value > 0.0:
self.off()
else:
self.on()
Expand Down

0 comments on commit 647f250

Please sign in to comment.