Kaffeebart Posted September 29, 2012 Report Posted September 29, 2012 (edited) Hi there i try to set a toggle switch for taxi lights. I know how to check an complete offset for changes - it´s like that event.offset("0D0C", "UW", "TaxiLights") But how can check just the bit which is important for the TaxiLights? (In this case the bit i need to know is :cool: I think i can read out the value of a bit so that i can decide if a LED has to turn on or off for the next step. Hope you´ll understand my english Thanks for your response. Stefan EDIT: Sorry for the question i think i found a workaround. If you´re interested in it i will post it. function TaxiLights(offset, value) -- TaxiLights prüfen und LED schalten gfd.SetBright(GFT8, 0, 12) TL = logic.And(ipc.readUW(0x0D0C), 8) -- Wert prüfen ob TaxiLight ein oder aus sind if TL == 1 then gfd.SetLight(GFT8, 0, 1) else gfd.ClearLight(GFT8, 0, 1) end end function SetTaxiLights(model, unit) -- Taxi Lights ein/ausschalten gfd.GetValues(model, unit) if gfd.TestButton(1) then -- prüfen ob Hebel für Taxi lights Wert true hat ipc.clearbitsUW(0X0D0C,8) else ipc.setbitsUW(0X0D0C,8) end end event.offset("0D0C", "UW", "TaxiLights") -- Abfrage ob Aktion bei Lichtern event.gfd(GFT8, 0, "SetTaxiLights") -- Abfrage ob Aktion bei Switches Edited September 29, 2012 by Kaffeebart
Pete Dowson Posted September 30, 2012 Report Posted September 30, 2012 Sorry for the question i think i found a workaround. If you´re interested in it i will post it. function TaxiLights(offset, value) -- TaxiLights prüfen und LED schalten gfd.SetBright(GFT8, 0, 12) TL = logic.And(ipc.readUW(0x0D0C), ... ... This is okay, but because you are provided with the value of offset 0D0C as the parameter "value" it would be more efficient to use it, so: TL = logic.And(value, ... BTW you need to put a space before your final ")" to stop the Forum software turning things into emoticon faces! ;-) Regards Pete
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now