Created
November 22, 2018 19:44
-
-
Save bettio/2c1d192d8b3691f97935d61a2d7e27ca to your computer and use it in GitHub Desktop.
Blinking a Led in Elixir on ESP32 with AtomVM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Blink do | |
@led_gpio 2 | |
def start() do | |
gpio_driver = GPIO.open() | |
GPIO.set_direction(gpio_driver, @led_gpio, :output) | |
loop(gpio_driver, 0) | |
end | |
def loop(gpio_driver, level) do | |
GPIO.set_level(gpio_driver, @led_gpio, level) | |
:timer.sleep(1000) | |
loop(gpio_driver, 1 - level) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment