GPIO LED
List GPIO pins
Circuits.GPIO.enumerate()
|> Kino.DataTable.new()
LED の点灯
{:ok, gpio} = Circuits.GPIO.open("GPIO17", :output)
Circuits.GPIO.write(gpio, 1)
Circuits.GPIO.close(gpio)
Circuits.GPIO.write_one("GPIO17", 0)
LED の点滅
{:ok, gpio} = Circuits.GPIO.open("GPIO17", :output)
Enum.each(1..10, fn index ->
Circuits.GPIO.write(gpio, rem(index, 2))
Process.sleep(500)
end)
Circuits.GPIO.close(gpio)