Skip to content

Instantly share code, notes, and snippets.

@TakehikoShimojima
Created June 23, 2018 03:11
Show Gist options
  • Select an option

  • Save TakehikoShimojima/3577af40af4005776ff6afb21bf88101 to your computer and use it in GitHub Desktop.

Select an option

Save TakehikoShimojima/3577af40af4005776ff6afb21bf88101 to your computer and use it in GitHub Desktop.
def send2ambient(dataRow):
(temp, humid, light, uv, press, noise, accelX, accelY, accelZ, batt) = struct.unpack('<hhhhhhhhhB', bytes.fromhex(dataRow))
am.send({'d1': temp / 100, 'd2': humid / 100, 'd3': press / 10, 'd4': (batt + 100) / 100, 'd5': light, 'd6': noise / 100})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment