From 253fd2d86371116c4c84c60d75b4ea7a2f381552 Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Thu, 20 May 2021 11:43:48 -0700 Subject: [PATCH] add PWM hook info --- Lua-Scripting.md | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/Lua-Scripting.md b/Lua-Scripting.md index 368b95f4..7ada2b7d 100644 --- a/Lua-Scripting.md +++ b/Lua-Scripting.md @@ -135,4 +135,31 @@ Valid `index` parameter values: ## Output -coming soon... \ No newline at end of file +### `startPwm(index, frequency, duty)` + +Initializes PWM on the specified index, starting at the specified frequency and duty cycle. The index selects which config field pin to use, see "Lua PWM Outputs" page in TunerStudio. + +- Parameters + - `index`: The index of the PWM channel to start. Valid values are 0 through 7, one for each of the 8 channels. + - `frequency`: Initial frequency of the output, in hertz (cycles per second). Valid values are between 1 and 1000hz. + - `duty`: Initial duty cycle of the output. `0.0` = fully off, and `1.0` = fully on. `0.25` = on 25% of the time, off 75% of the time. +- Returns + - none + +### `setPwmDuty(index, duty)` + +Set the duty cycle of the specified PWM channel. + +- Parameters + - `index`: The index of the PWM channel to set. + - `duty`: Desired duty cycle of the output. `0.0` = fully off, and `1.0` = fully on. `0.25` = on 25% of the time, off 75% of the time. +- Returns + - none + +### `setPwmFreq(index, frequency)` + +- Parameters + - `index`: The index of the PWM channel to set. + - `frequency`: Initial frequency of the output, in hertz (cycles per second). Valid values are between 1 and 1000hz. +- Returns + - none \ No newline at end of file