From 6101b734430b16372a607d4a9e2aa92506cb29ae Mon Sep 17 00:00:00 2001
From: nikhil b lal <nikhil@macbook-air.media.mit.edu>
Date: Mon, 22 Apr 2024 21:26:21 -0400
Subject: [PATCH] it's the little things

---
 code/main.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/code/main.py b/code/main.py
index ba4b5a7..467ca52 100644
--- a/code/main.py
+++ b/code/main.py
@@ -6,6 +6,9 @@ spike_duration = 3.5 # spike duration, ms
 pulse_duration = 500 # dwell (including spike time), ms
 total_cycle = 3000  # period of the cycle, ms
 
+sd_math = int(spike_duration*1000)
+pd_math = int((pulse_duration-spike_duration)*1000)
+
 # establish pins
 led_pin = Pin(27, Pin.OUT)
 sol_pin = Pin(29, Pin.OUT)
@@ -27,12 +30,12 @@ def pwm_control(timer):
     # on cycle
     pwm_led.duty_u16(65535) # set the duty cycle of the led
     pwm_sol.duty_u16(65535) # set the duty cycle of the solenoid
-    sleep_us(int(spike_duration*1000))
+    sleep_us(sd_math)
     
     # pwm cycle
     pwm_led.duty_u16(hold_duty) # set the duty cycle of the led
     pwm_sol.duty_u16(hold_duty) # set the duty cycle of the solenoid
-    sleep_us(int((pulse_duration-spike_duration)*1000))
+    sleep_us(pd_math)
     
     # off cycle
     pwm_led.duty_u16(0) # set the duty cycle of the led
-- 
GitLab