Simulation Instruments

Home›All functions›Hardware

Hardware

Simulation Instrument Studio 1

How to wire a board and load a sketch is on the hardware setup page. These are the calls.

hw_led_add

Simulation Instrument Studio 1

Overloads

hw_led_add()
Photo slot: shots/hw_led_add.png

hw_led_set

Simulation Instrument Studio 1

Overloads

hw_led_set(hw_led_id, brightness)

A hardware pin call. It talks to a board on USB serial or TCP 4731.

Parameters

#NameTypeDescription
1hw_led_idStringThe is the reference to the LED output. You can get this reference from the hw_led_add function.
2brightnessNumber/BoolThe initial state of the LED. Ranges from 1.0 or true (full brightness) to 0.0 or false (off).

Example

-- Pin on the board at 4731
id = hw_led_set(0)
Photo slot: shots/hw_led_set.png

hw_dial_add

Simulation Instrument Studio 1

Overloads

hw_dial_add()
Photo slot: shots/hw_dial_add.png

hw_dial_set_acceleration

Simulation Instrument Studio 1

Overloads

hw_dial_set_acceleration(hw_dial_id, acceleration)

A hardware pin call. It talks to a board on USB serial or TCP 4731.

Parameters

#NameTypeDescription
1hw_dial_ididThe is the reference to the rotary encoder. You can get this reference from the hw_dial_add function.
2accelerationNumberA multiplier that will make the dial generate extra callbacks when the dial is being rotated faster. The multiplier is the maximum number of callbacks of one dial tick when this dial is being rotated at maximum speed.

Example

-- Pin on the board at 4731
id = hw_dial_set_acceleration(0)
Photo slot: shots/hw_dial_set_acceleration.png

hw_input_add

Simulation Instrument Studio 1

Overloads

hw_input_add()
Photo slot: shots/hw_input_add.png

hw_input_read

Simulation Instrument Studio 1

Overloads

hw_input_read(hw_input_id)

A hardware pin call. It talks to a board on USB serial or TCP 4731.

Parameters

#NameTypeDescription
1hw_input_idStringThe is the reference to the input. You can get this reference from the hw_input_add function.

Example

-- Pin on the board at 4731
id = hw_input_read(0)
Photo slot: shots/hw_input_read.png

hw_output_add

Simulation Instrument Studio 1

Overloads

hw_output_add()
Photo slot: shots/hw_output_add.png

hw_output_set

Simulation Instrument Studio 1

Overloads

hw_output_set(hw_output_id, state)

A hardware pin call. It talks to a board on USB serial or TCP 4731.

Parameters

#NameTypeDescription
1hw_output_idStringThe is the reference to the output. You can get this reference from the hw_output_add function.
2stateBooleanThe state to set the output. When true, the pin will be driven high, otherwise low.

Example

-- Pin on the board at 4731
id = hw_output_set(0)
Photo slot: shots/hw_output_set.png

hw_adc_input_add

Simulation Instrument Studio 1

Overloads

hw_adc_input_add()
Photo slot: shots/hw_adc_input_add.png

hw_adc_input_read

Simulation Instrument Studio 1

Overloads

hw_adc_input_read(hw_adc_input_id)

A hardware pin call. It talks to a board on USB serial or TCP 4731.

Parameters

#NameTypeDescription
1hw_adc_input_idStringThe is the reference to the ADC input. You can get this reference from the hw_adc_input_add function.

Example

-- Pin on the board at 4731
id = hw_adc_input_read(0)
Photo slot: shots/hw_adc_input_read.png

hw_dac_output_add

Simulation Instrument Studio 1

Overloads

hw_dac_output_add()
Photo slot: shots/hw_dac_output_add.png

hw_dac_output_set

Simulation Instrument Studio 1

Overloads

hw_dac_output_set(hw_dac_output_id, value)

A hardware pin call. It talks to a board on USB serial or TCP 4731.

Parameters

#NameTypeDescription
1hw_dac_output_idStringThe is the reference to the DAC output. You can get this reference from the hw_dac_output_add function.
2valueNumberThe state to set the output. Ranges from 0.0 (GND) to 1.0 (VCC)

Example

-- Pin on the board at 4731
id = hw_dac_output_set(0)
Photo slot: shots/hw_dac_output_set.png

hw_output_pwm_add

Simulation Instrument Studio 1

Overloads

hw_output_pwm_add()
Photo slot: shots/hw_output_pwm_add.png

hw_output_pwm_duty_cycle

Simulation Instrument Studio 1

Overloads

hw_output_pwm_duty_cycle(hw_output_pwm_id, duty_cycle)

A hardware pin call. It talks to a board on USB serial or TCP 4731.

Parameters

#NameTypeDescription
1hw_output_pwm_idStringThe is the reference to the PWM output. You can get this reference from the hw_output_pwm_add function.
2duty_cycleNumberThe new PWM duty cycle. Range 0.0 - 1.0, 0.0 being off, and 1.0 on.

Example

-- Pin on the board at 4731
id = hw_output_pwm_duty_cycle(0)
Photo slot: shots/hw_output_pwm_duty_cycle.png

hw_chr_display_add

Simulation Instrument Studio 1

Overloads

hw_chr_display_add()
Photo slot: shots/hw_chr_display_add.png

hw_chr_display_set_text

Simulation Instrument Studio 1

Overloads

hw_chr_display_set_text(hw_chr_display_id, text)
hw_chr_display_set_text(hw_chr_display_id, line, text)
hw_chr_display_set_text(hw_chr_display_id, display, line, text)

A hardware pin call. It talks to a board on USB serial or TCP 4731.

Parameters

#NameTypeDescription
1hw_chr_display_idObjectThis is the reference to the character display output. You can get this reference from the hw_chr_display_add function.
2displayNumber(Optional) The display where you wish to show the text. This only works with character display types that can be daisy chained. First display is 0.
3lineNumber(Optional) The line where you wish to put the text. First line is 0.
4textStringThe text.

Example

-- Pin on the board at 4731
id = hw_chr_display_set_text(0)
Photo slot: shots/hw_chr_display_set_text.png

hw_chr_display_set_brightness

Simulation Instrument Studio 1

Overloads

hw_chr_display_set_brightness(hw_chr_display_id, brightness)
hw_chr_display_set_brightness(hw_chr_display_id, display, brightness)

A hardware pin call. It talks to a board on USB serial or TCP 4731.

Parameters

#NameTypeDescription
1hw_chr_display_idObjectThis is the reference to the character display output. You can get this reference from the hw_chr_display_add function.
2displayNumber(Optional) The display where you wish to put the text. This only works with character display types that can be daisy chained. First display is 0.
3brightnessNumberThe brightness. Ranges from 0.0 (Off) to 1.0 (Full brightness).

Example

-- Pin on the board at 4731
id = hw_chr_display_set_brightness(0)
Photo slot: shots/hw_chr_display_set_brightness.png

hw_button_array_add

Simulation Instrument Studio 1

Overloads

hw_button_array_add()
Photo slot: shots/hw_button_array_add.png

hw_stepper_motor_add

Simulation Instrument Studio 1

Overloads

hw_stepper_motor_add()
Photo slot: shots/hw_stepper_motor_add.png

hw_stepper_motor_calibrate

Simulation Instrument Studio 1

Overloads

hw_stepper_motor_calibrate()
Photo slot: shots/hw_stepper_motor_calibrate.png

hw_stepper_motor_position

Simulation Instrument Studio 1

Overloads

hw_stepper_motor_position(hw_stepper_motor_id, position)
hw_stepper_motor_position(hw_stepper_motor_id, position, direction)

A hardware pin call. It talks to a board on USB serial or TCP 4731.

Parameters

#NameTypeDescription
1hw_stepper_motor_idObjectThe is the reference to the stepper motor. You can get this reference from the hw_stepper_motor_add function.
2positionNumberThe desired position, ranging from 0.0 to 1.0.
3directionString(Optional) The desired direction. Can be 'SLOWEST', 'FASTEST', 'CLOCKWISE', 'COUNTERCLOCKWISE', 'ENDLESS_CLOCKWISE', 'ENDLESS_COUNTERCLOCKWISE' or 'STOP' (from AM/). Defaults to 'FASTEST'.

Example

-- Pin on the board at 4731
id = hw_stepper_motor_position(0)
Photo slot: shots/hw_stepper_motor_position.png

hw_stepper_motor_speed

Simulation Instrument Studio 1

Overloads

hw_stepper_motor_speed(hw_stepper_motor_id, speed_rpm)

A hardware pin call. It talks to a board on USB serial or TCP 4731.

Parameters

#NameTypeDescription
1hw_stepper_motor_idObjectThe is the reference to the stepper motor. You can get this reference from the hw_stepper_motor_add function.
2speedrpmThe desired speed in rounds per minute (rpm).

Example

-- Pin on the board at 4731
id = hw_stepper_motor_speed(0)
Photo slot: shots/hw_stepper_motor_speed.png

hw_message_port_add

Simulation Instrument Studio 1

Overloads

hw_message_port_add()
Photo slot: shots/hw_message_port_add.png

hw_message_port_send

Simulation Instrument Studio 1

Overloads

hw_message_port_send(hw_message_port_id, message_id, payload_type, payload)

A hardware pin call. It talks to a board on USB serial or TCP 4731.

Parameters

#NameTypeDescription
1hw_message_port_idStringThe is the reference to the Message port. You can get this reference from the hw_message_port_add function.
2message_idIntegerThe message identifier, this can be an integer ranging from 0 to 65535 (16 bit unsigned int).
3payload_typeStringPayload type. Can be 'INT', 'FLOAT, 'BYTE' or 'STRING'.
4payloadObjectSend additional values with your message. Max 16 values when using INT or FLOAT. Max 64 bytes with using BYE and max 64 characters when using STRING.

Example

-- Pin on the board at 4731
id = hw_message_port_send(0)
Photo slot: shots/hw_message_port_send.png

hw_connected

Simulation Instrument Studio 1

Overloads

hw_connected(hw_node_id)
hw_connected(hw_id)

A hardware pin call. It talks to a board on USB serial or TCP 4731.

Parameters

#NameTypeDescription
1hw_node_id / hw_idHardware node / StringCan be a hw_node_id, which is a reference to a certain hardware node. It is received from the hw_button_add, hw_switch_add, hw_dial_add etc. functions. Alternatively, it can also be a hardware id Hardware ID list.

Example

-- Pin on the board at 4731
id = hw_connected(0)
Photo slot: shots/hw_connected.png