Electronic bricks

This is a documentation for the electronic bricks library.

Digital output

LED

Digital input

Analog input

Digital output

This category is based on digital_output in core library.

LED

Messages

  • Led < led_on(): Switch on the LED.
  • Led < led_off(): Switch off the LED.
  • Led < led_toggle(): Switch the LED to the opposite state.

Configuration

A simple example which use this device is available here.

Buzzer

Messages

  • Buzzer < buzzer_on(): Switch on the buzzer.
  • Buzzer < buzzer_off(): Switch off the buzzer.
  • Buzzer < buzzer_delay(delay : UInt16): Switch on the buzzer for delay milliseconds.

Configuration

A simple example which use this device is available here.

Digital input

This category is based on digital_input in core library.

Button

This basic device allows to detect when the button is pressed or released.

Messages

  • Button > press(): The button has been pressed.
  • Button > release(): The button has been released.

Configuration

A simple example which use this device is available here.

Tilt switch

This device detect when the tilt switch is moved.

Messages

  • TiltSwitch > tilt_toggle(): The switch position has been changed.

Configuration

A simple example which use this device is available here.

Water sensor

Messages

  • WaterSensor > dry(): The sensor is dry.
  • WaterSensor > wet(): The sensor is wet.

Configuration

A simple example which use this device is available here.

Analog input

This category is based on analog_input in core library.

Light sensor

The light sensor sends the light value when it changes but it is also possible to force the reading at any time. By default the sensor checks if the value has change every 500 milliseconds (refresh_rate). This is deliberate slow to avoid to many refresh when the light varies greatly.

Messages

  • LightSensor < read_light(): Request the light value to the sensor.
  • LightSensor > light_value(val : UInt16): The light value from the sensor.

Configuration

A simple example which use this device is available here.

Rotation sensor

The rotation sensor sends the rotation value when its changes but it is also possible to force the reading at any time. By default it uses the predetermined refresh rate so it checks if the value has changed every 20 milliseconds. This should be enough for most of applications.

Messages

  • RotationSensor < read_rotation(): Request the rotation value to the sensor.
  • RotationSensor > rotation_value(val : UInt16): The rotation value from the sensor.

Configuration

A simple example which use this device is available here.

Sound sensor

The sound sensor should be used to detect a brutal change in sound environment but not to monitoring the sound level. By default it checks the sound value every millisecond (refresh_rate) and if it detects a change it compares with its current maximum. When it gets 100 different measures (sample_rate) it sends the maximal recording value. Properties might be changed to fit your needs. Otherwise the reading of the instant value can be forced.

Messages

  • SoundSensor < read_sound(): Request the sound value to the sensor.
  • SoundSensor > sound_value(val : UInt16): The sound value from the sensor.

Configuration

A simple example which use this device is available here.

Temperature sensor

The temperature sensor sends the temperature in degree Celsius when its changes but it is also possible to force the reading at any time. By default it checks the value every 500 milliseconds (refresh rate).

Messages

  • TemperatureSensor < read_temperature(): Request the temperature to the sensor.
  • TemperatureSensor > temperature_value(val : UInt16): The temperature from the sensor.

Configuration

A simple example which use this device is available here.