-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-script
29 lines (19 loc) · 1012 Bytes
/
test-script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
-- Test Script --
-- Omar Abdelghamy and Davin Birdi
-- November 24, 2016
-- From the Google Drive Document Omar and I made Nov 5
-- To load to the Race-Capture, remove all new lines and tabs so that the entire code is condensed into one line and copy to a terminal program.
-- LUA CODE --
--Working Version:
setTickRate(30)
-- Initialized CAN Baud rate at 500kHz
initCAN(0,500000)
function onTick()
-- Maps variables to incoming CAN data [note rxCAN function timeout parameter has been removed]
id, ext, data = rxCAN(0)
-- Prints to the terminal window:
print(" ID: " ..id .." Ext: " ..ext)
println(" Data1: " ..data[1] .." Data2: " ..data[2] .." Data3: " ..data[3] .." Data4: " ..data[4] .." Data5: " ..data[5])
end
--Working Version (Condensed):
setTickRate(30) function onTick() initCAN(0,500000) id, ext, data = rxCAN(0) print(" ID: " ..id .." Ext: " ..ext) println(" Data1: " ..data[1] .." Data2: " ..data[2] .." Data3: " ..data[3] .." Data4: " ..data[4] .." Data5: " ..data[5]) end