Core library

Arduino standard library

Arduino timer

The arduino_timer file provides a soft timer witch is used by quite all devices.

Message

  • timer < timer_start(delay : Int16): Start a timer for delay milliseconds.
  • timer < timer_cancel(): Cancel the current timer.
  • timer > timer_timeout(): The timer is over.

Digital input

There are three ways to use digital input. All of them use same messages.

Messages

  • DigitalInput < read_digital_input(): Request the value.
  • DigitalInput > digital_input_value(value : DigitalState): The digital sate of the component.

Simple digital input

The digital state is send only when it is requested.

Configuration

Periodic digital input

In addition to send the result when it is requested, the digital state is send periodically every refresh_rate milliseconds.

Configuration

On change digital input

In addition to send the result when it is requested, the digital state is send at every change.

Configuration

Digital output

Enables to set a digital state on a pin.

Messages

  • DigitalOutput < set_digital_output(value : DigitalState): Set value as the digital state.

Configuration

Analog input

Three types of analog input can be used. All of them use same messages but keep in mind that some properties can differ.

Messages

  • AnalogInput < read_analog_input(): Request the analog value.
  • AnalogInput > analog_input_value(value : Int16): The analog value.

Simple analog input

The value of the analog pin is send only when it is requested.

Configuration

Periodic analog input

In addition to send the result when it is requested, the value is send periodically every refresh_rate milliseconds.

Configuration

On change analog input

In addition to send the result when it is requested, the value state is send when a change is detected. To avoid too many messages the value is checked every 20 milliseconds by default (refresh_rate). Moreover to prevent fake changes there is a value_precision property which enables to fix the threshold which determine if the value has changed. The default value is 1. Keep in mind a value of 1 imply that the analog value has to vary at least of 2 to get refreshed.

Configuration

PWM

Enables to set a PWM value between 0 and 255 on a pin.

Messages

  • Pwm < set_pwm_value(value : UInt8): Set value as PWM value.

Configuration