Skip to content

Instantly share code, notes, and snippets.

@sankarcheppali
Created June 16, 2017 06:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sankarcheppali/fc578c6bd8ca6bcc23cea1b850557b6f to your computer and use it in GitHub Desktop.
Save sankarcheppali/fc578c6bd8ca6bcc23cea1b850557b6f to your computer and use it in GitHub Desktop.
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