button state example

Q&A For ShiftX2, RGB sequential shift light <a href="https://wiki.autosportlabs.com/ShiftX2">Installation and Operation Guide</a>
Post Reply
Posts: 69
Joined: Sat Mar 25, 2017 1:43 am

button state example

Post by TXBDan »

Hi all,

Does anyone have a script example using the button state? I assume it'd have to be polled. Is any debouncing required?

I'd like to use the button to do something useful like switch dashboard screens or maybe toggle shiftlight/lap timing modes.


Posts: 138
Joined: Mon Aug 05, 2013 10:22 pm

Post by gizmodo »

The example script has this implemented.

function sxOnBut(b)
--called if the button state changes
println('button: ' ..b)

This is where it is called:
function sxChkCan()
if id==sxCanId then sxInit() end
if id==sxCanId+60 and sxOnBut~=nil then sxOnBut(data[1]) end

Post Reply