Skip to content
Snippets Groups Projects
Commit 6101b734 authored by nikhil b lal's avatar nikhil b lal
Browse files

it's the little things

parent c8b0b2d0
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment