diff --git a/src/main.c b/src/main.c
index 82dada6002f8b3ad5f6a3c115efc26f11603be40..976995ba122616750895b83dcc91ce350f0a02c9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -121,7 +121,8 @@ void callback(uint gpio, uint32_t events)
 
 {
 
-    uint32_t event3 = events;
+    volatile uint slice_num = pwm_gpio_to_slice_num(27);
+    volatile duration = pwm_get_counter(slice_num) * 42;
     /* volatile uint another_slice_num = pwm_gpio_to_slice_num(27);
 
     if (events & GPIO_IRQ_LEVEL_HIGH)
@@ -171,6 +172,7 @@ void pwm_echo_init()
     29 gpio_set_function(gpio, GPIO_FUNC_PWM);
     */
     // count once for every 42 cycles the PWM B input is high
+    // one cycle approximately equal to 20 ms
     pwm_set_clkdiv(slice_num, 42);
     pwm_set_wrap(slice_num, 0xFFFF);
     pwm_set_clkdiv_mode(slice_num, PWM_DIV_B_HIGH);
@@ -211,7 +213,7 @@ int main()
 
     while (1)
     {
-    }
+        }
     /*
     timer_hw->dbgpause = 0;
     gpio_init(27);