GithubHelp home page GithubHelp logo

heis_driver's Introduction

Elixir elevator driver

All functions are documented in the link

How to include the modules in your project

If you are using Mix as you Elixir build tool (which you really should), go into mix.exs and modify the function deps to contain

defp deps do
    [
      {:heis_driver, git: "https://github.com/jornbh/heis_driver.git", tag: "0.1.2"}
    ]
  end

Modify the tag to correspond to a newer release if some bugfixes are added later.

The driver should be available as a module named Driver, just like your normal modules.

Using the driver in Erlang

If you are using rebar3, downloading the dependency is somewhat similar, but you need a plugin. Just add/modify the lines for plugins and provider_hooks in rebar.config, so that they look like this

{plugins, [rebar_mix]}.
{provider_hooks, [{post, [{compile, {mix, consolidate_protocols}}]}]}.

This makes it possible to include elixir-dependencies. Afterwards, modify the line for deps, so that it becomes:

{deps, [
    {heis_driver, {git, "git://github.com/jornbh/heis_driver.git", {tag, "0.1.2"}}}
]}.

Now, you will have to write call the module, which will be an atom that starts With "Elixir.", and the rest is just the normal module name. If the function has problematic signs, use the same type of quotes around it as well.

'Elixir.Driver':set_door_state(closed). 
'Elixir.Driver':'button_pressed?'(1, hall_up).

Further reading

GenServers are a really neat way to make servers without having to rewrite the same code all the time. It works Exactly the same in Erlang as well, but it is called gen_server instead. The erlang documentation is kind of difficult to understand, so use the elixir-video and "Translate" it to Erlang (gen_server:call(...) instead of GenServer.call(...)).

The short version is that a GenServer implements the basic parts of a server, and the code that is seen in this file is the "Blanks" you have to fill in

A youtube-video that explains GenServers and Supervisors

https://www.youtube.com/watch?v=3EjRvaCOl94

heis_driver's People

Contributors

jornbh avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.