Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
local function consume_data( payload )
--we will parse the payload and excute it,publish the return value
print(payload)
msg=cjson.decode(payload)
loadNumber=msg.ln
targetStatus=msg.ts
if(targetStatus==0) then loadStatus=bit.clear(loadStatus,loadNumber)
else loadStatus = bit.set(loadStatus,loadNumber) end
serialOut(loadStatus)
print ("Status of the loads : ")
print (loadStatus)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment