Io

Summary
Io
Types
pinState
Functions
high
low
Types
mode
Functions
input
output
inputPullup
toggleGiven a high value, returns a low value.
printStringWrites a string to the serial output.
printCharListWrites a character list to the serial output.
printFloatWrites a float to the serial output.
printIntWrites an integer to the serial output.
Types
base
Functions
binary
octal
decimal
hexadecimal
printIntBaseWrites an integer in the given base to the serial output.
printFloatPlacesWrites a float with the given number of decimal places to the serial output.
beginSerialSets up serial ouput
pinStateToIntConverts a pinState to an integer representation.
intToPinStateConverts an integer to a pinState representation.
digWriteWrites a value directly to a pin.
digReadReads a value direction from a pin.
digInCreates an input signal given some pin identifier.
digOutTakes in an input signal and writes the value contained in the signal to the given pin.
anaReadReads a value directly from an analog pin.
anaWriteWrites an analog (PWM) value directly to an analog pin.
anaInCreates an analog input signal given some pin identifier.
anaOutTakes in an analog input signal and writes the value contained in the signal to the given analog pin.
pinModeToIntConverts a pinMode to an integer representation.
intToPinModeConverts an integer representation to a pinMode
setPinModeSets the mode of a specified pin
risingEdgeTakes in a signal and a previous state and outputs a new signal that fires when the input signal transitions from low to high.
fallingEdgeTakes in a signal and a previous state and outputs a new signal that fires when the input signal transitions from high to low.
edgeTakes in a signal and a previous state and outputs a new signal that fires when the input transitions from high to low or low to high

Types

pinState

pinState

Constructors

Functions

high

Type Signature

() -> pinState

low

Type Signature

() -> pinState

Types

mode

mode

Constructors

Functions

input

Type Signature

() -> mode

output

Type Signature

() -> mode

inputPullup

Type Signature

() -> mode

toggle

Given a high value, returns a low value.  Given a low value, returns a high value.

Type Signature

(pinState) -> pinState

Parameters

p : pinStateThe pinState which you would like to find the opposite value of.

Returns

The opposite pinState.

printString

Writes a string to the serial output.

Type Signature

(string) -> unit

Parameters

str : stringThe string to write

Returns

unit

printCharList

Writes a character list to the serial output.

Type Signature

<;n>(list<uint8;n>) -> unit

Parameters

cl : list<uint8;n>The character list to print

Returns

unit

printFloat

Writes a float to the serial output.

Type Signature

(float) -> unit

Parameters

f : floatThe number to write

Returns

unit

printInt

Writes an integer to the serial output.

Type Signature

(int32) -> unit

Parameters

n : int32The number to write

Returns

unit

Types

base

Functions

binary

Type Signature

() -> base

octal

Type Signature

() -> base

decimal

Type Signature

() -> base

hexadecimal

Type Signature

() -> base

printIntBase

Writes an integer in the given base to the serial output.

Type Signature

(int32, base) -> unit

Parameters

n : int32The number to write
b : baseThe base to use

Returns

unit

printFloatPlaces

Writes a float with the given number of decimal places to the serial output.

Type Signature

(float, int32) -> unit

Parameters

f : floatThe number to write
numPlaces : int32The number of decimal places to use

Returns

unit

beginSerial

Sets up serial ouput

Type Signature

(uint32) -> unit

Parameters

speed : uint32Sets the data rate in bits per second (baud) for serial data transmission.

Returns

Unit

See also

https://www.arduino.cc/en/Serial/Begin

pinStateToInt

Converts a pinState to an integer representation.

Type Signature

(pinState) -> uint8

Parameters

value : pinStateThe pinState to Converts

Returns

0 for low and 1 for high

intToPinState

Converts an integer to a pinState representation.

Type Signature

(uint8) -> pinState

Parameters

value : uint8The integer value to convert

Returns

low for 0 and high for anything else

digWrite

Writes a value directly to a pin.

Type Signature

(uint16, pinState) -> unit

Parameters

pin : uint16The pin to write to.
value : pinStateThe state the pin should be in.

Returns

Unit

See also

digOut

digRead

Reads a value direction from a pin.

Type Signature

(uint16) -> pinState

Parameters

pin : uint16The pin to read from.

Returns

The value of the pin.

See also

digIn

digIn

Creates an input signal given some pin identifier.

Type Signature

(uint16) -> sig<pinState>

Parameters

pin : uint16The pin to read from

Returns

A signal holding the state of the pin.

See also

digRead

digOut

Takes in an input signal and writes the value contained in the signal to the given pin.

Type Signature

(uint16, sig<pinState>) -> unit

Parameters

pin : uint16The pin to write to
sig : sig<pinState>The signal to output to the pin

Returns

Unit

See also

digWrite

anaRead

Reads a value directly from an analog pin.

Type Signature

(uint16) -> uint16

Parameters

pin : uint16The pin to read from

Returns

A value ranging from 0 to 1023.

See also

anaIn https://www.arduino.cc/en/Reference/AnalogRead

anaWrite

Writes an analog (PWM) value directly to an analog pin.

Type Signature

(uint16, uint8) -> unit

Parameters

pin : uint16The pin to write to
value: uint8The analog value to write to the pin.  This number ranges from 0 (always off) to 255 (always on)

See also

anaOut https://www.arduino.cc/en/Reference/AnalogWrite

anaIn

Creates an analog input signal given some pin identifier.

Type Signature

(uint16) -> sig<uint16>

Parameters

pin : uint16The pin to read from

See also

anaRead

anaOut

Takes in an analog input signal and writes the value contained in the signal to the given analog pin.

Type Signature

(uint16, sig<uint16>) -> unit

Parameters

pin : uint16The pin to write to
sig : sig<uint16>The analog signal to output to a pin

Returns

Unit

pinModeToInt

Converts a pinMode to an integer representation.

Type Signature

(mode) -> uint8

Parameters

m : modeThe mode to convert

Returns

0 for input, 1 for output and 2 for inputPullup

intToPinMode

Converts an integer representation to a pinMode

Type Signature

(uint8) -> mode

Parameters

m : uint8 - The mode to convert

Returns

input for 0, output for 1 and inputPullup for 2

setPinMode

Sets the mode of a specified pin

Type Signature

(uint16, mode) -> unit

Returns

Unit

risingEdge

Takes in a signal and a previous state and outputs a new signal that fires when the input signal transitions from low to high.

Type Signature

(sig<pinState>, pinState ref) -> sig<unit>

Parameters

sig : sig<pinState>The digital input signal
prevState : pinState refHolds the previous state of the signal

Returns

A signal of type unit.  The signal fires unit on a rising edge, otherwise it does not fire.

fallingEdge

Takes in a signal and a previous state and outputs a new signal that fires when the input signal transitions from high to low.

Type Signature

(sig<pinState>, pinState ref) -> sig<unit>

Parameters

sig : sig<pinState>The digital input signal
prevState : pinState refHolds the previous state of the signal

Returns

A signal of type unit.  The signal fires unit on a falling edge, otherwise it does not fire.

edge

Takes in a signal and a previous state and outputs a new signal that fires when the input transitions from high to low or low to high

Type Signature

(sig<pinState>, pinState ref) -> sig<pinState>

Parameters

sig : sig<pinState>The digital input signal
prevState : pinState refHolds the previous state of the signal

Returns

A signal that outputs high on a rising edge and low on a falling edge.

Takes in an input signal and writes the value contained in the signal to the given pin.
Creates an input signal given some pin identifier.
Reads a value direction from a pin.
Writes a value directly to a pin.
Creates an analog input signal given some pin identifier.
Takes in an analog input signal and writes the value contained in the signal to the given analog pin.
Reads a value directly from an analog pin.
Close