Archytax v0.1.1 Archytax
This is the Main Module of the Library, it serves as a bridge for the interface and the Board, also it manages the messages coming from the connected devices.
Summary
Functions
Send analog value val
to the specified pin_number
Send digital MIDI signal value val
to the specified pin_number
.
Note: If possible use set_digital_pin/2 instead
Get the current state of Archytax
Get the current pins states and values as a Map. Useful to get the current value of digital pins
Get the state of the specified pin
Not gonna make it to the final version
Try to create a new connection using the existing Board GenServer
Enable or Disable analog pin reporting according to the val
provided for the specified pin
Enable or Disable digital port reporting according to the val
provided for the specified pin
Send reset signal to board
Set the digital value for the specified pin_number
Set the pin mode of the specified mode, for pin modes codes, check firmata documentation: https://github.com/firmata/protocol/blob/master/protocol.md
Issue a sysex command message to the Board
Send any kind of information to the Board
Functions
Send analog value val
to the specified pin_number
.
Note: pin_number
must be inside the range from 0 to 15 as specified by MIDI message format.
Examples
iex> Archytax.analog_write(9, 222)
:ok
iex> Archytax.analog_write(999, 1)
{:error, "Pin not found"}
Send digital MIDI signal value val
to the specified pin_number
.
Note: If possible use set_digital_pin/2 instead.
Examples
iex> Archytax.digital_write(13, 1)
:ok
iex> Archytax.digital_write(999, 1)
{:error, "Pin not found"}
Get the current pins states and values as a Map. Useful to get the current value of digital pins.
Examples
iex> {:ok, pins} = Archytax.get_pins
iex> digital_value = get_in(pins, [13, :value])
1
Get the state of the specified pin
.
NOTE: The pin state is any data written to the pin (it is important to note that pin state != pin value).
Enable or Disable analog pin reporting according to the val
provided for the specified pin
.
Note: pin
refers to the analog pin (i.e. A0, A1, etc.)
disable(0) / enable(non-zero)
Examples
iex> Archytax.report_analog_pin(5, 1)
:ok
Enable or Disable digital port reporting according to the val
provided for the specified pin
.
disable(0) / enable(non-zero)
Examples
iex> Archytax.report_digital_port(5, 1)
:ok
iex> Archytax.report_digital_port(999, 1)
{:error, "Pin not found"}
Set the digital value for the specified pin_number
.
Examples
iex> Archytax.set_digital_pin(13, 1)
:ok
iex> Archytax.set_digital_pin(13, 0)
:ok
iex> Archytax.set_digital_pin(999, 1)
{:error, "Pin not found"}
Set the pin mode of the specified mode, for pin modes codes, check firmata documentation: https://github.com/firmata/protocol/blob/master/protocol.md
Examples
iex> Archytax.set_pin_mode(13, 1)
:ok
iex> Archytax.set_pin_mode(9, 3)
:ok
iex> Archytax.set_pin_mode(999, 1)
{:error, "Pin not found"}