Updated Lua Scripting (markdown)

This commit is contained in:
rusefillc 2021-11-26 09:11:41 -05:00
parent e3b9cc610d
commit bbcacc9547
1 changed files with 16 additions and 3 deletions

View File

@ -229,6 +229,7 @@ Set the duty cycle of the specified PWM channel.
## Examples
# timer
```
t = Timer.new();
timingAdd = 0;
@ -257,7 +258,7 @@ end
# PWM
```
-- index 0, 100Hz, zero duty inititally
startPwm(0, 100, 0)
@ -271,7 +272,7 @@ function onTick()
end
```
# CAN transmit
```
function onTick()
tps = getSensor("CLT")
@ -289,8 +290,20 @@ function onTick()
end
```
# table
# CAN receive
```
canRxAdd(0x570)
function onCanRx(bus, id, dlc, data)
print('got CAN id=' .. id .. ' dlc=' .. dlc)
id11 = id % 2048
if id11 == 0x500 then --Check can state of BCM
canState = data[1]
end
end
```
# table
```
tableIndex = findTableIndex("duty")