Hw output pwm add

From Sim Innovations Wiki
Revision as of 14:46, 21 May 2016 by Admin (talk | contribs) (Created page with "== Description == '''hw_output_pwm_id = hw_output_pwm_add(hw_id, frequency_hz, initial_duty_cycle)''' '''hw_output_pwm_add''' is used to add a hardware PWM output to your i...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Description

hw_output_pwm_id = hw_output_pwm_add(hw_id, frequency_hz, initial_duty_cycle)

hw_output_pwm_add is used to add a hardware PWM output to your instrument.

Return value

Argument Type Description
hw_output_pwm_id String This value can be used for further reference.

Arguments

# Argument Type Description
1 hw_id String The is the reference to the input. You can choose to bind to an existing Hardware ID (Hardware_id_list), or define your own Hardware ID, which you can dynamicly couple to an external type of hardware, such as the Teensy or Arduino.
2 frequency_hz Function The frequency of the PWM output signal.
3 initial_duty_cycle Function The initial PWM duty cycle.

Example

-- Bind to Raspberry Pi 2, Header P1, Pin 40
-- PWM frequency is set to 1 kHz, with a duty cycle of 50%.
output_id = hw_output_pwm_add("RPI_V2_P1_40", 1000, 50)

-- We can change the duty cycle runtime, in this case 20%
hw_output_pwm_duty_cycle(output_id, 20)