 defmodule Doorpi.GpioWorker do
   use GenServer
+
+  @pin_door1 17
+  @pin_door2 18
 
   def start_link(opts \\ []) do
     GenServer.start_link(__MODULE__, opts, name: __MODULE__)

    {:noreply, state}
  end



  defp signal_startup(led1, led2):
    GPIO.write(led1, 1)
    :timer.sleep(500)
    GPIO.write(led1, 0)
    GPIO.write(led2, 1)
    :timer.sleep(500)
    GPIO.write(led1, 1)
    GPIO.write(led2, 0)
    :timer.sleep(500)
    GPIO.write(led1, 0)
    GPIO.write(led2, 1)
    :timer.sleep(500)
    GPIO.write(led1, 1)
    GPIO.write(led2, 1)
    :timer.sleep(250)
    GPIO.write(led1, 0)
    GPIO.write(led2, 0)
    :timer.sleep(250)
    GPIO.write(led1, 1)
    GPIO.write(led2, 1)
    :timer.sleep(250)
    GPIO.write(led1, 0)
    GPIO.write(led2, 0)
    :timer.sleep(250)
    GPIO.write(led1, 1)
    GPIO.write(led2, 1)
    :timer.sleep(250)
  end
end

    {:ok, led1} = Gpio.start_link(27, :output)
    {:ok, led2} = Gpio.start_link(22, :output)
    signal_startup(led1, led2)

    {:ok, door1} = Gpio.start_link(@pin_door1, :input)
    {:ok, door2} = Gpio.start_link(@pin_door2, :input)
    # :ok = GpioRpi.set_mode(b1, :down)
    # :ok = GpioRpi.set_mode(b2, :down)
    :ok = Gpio.set_int(door1, :both)
    :ok = Gpio.set_int(door2, :both)

    {:ok, %{led1: led1, led2: led2, door1: :open, door2: :open}}
  end

  def handle_cast({:set_led1, value}, state) do
