From 7a05f08d56d61ed7a771c18132668642131f3d2c Mon Sep 17 00:00:00 2001 From: Petr Gotthard Date: Thu, 12 Oct 2017 22:32:07 +0200 Subject: [PATCH] Editorial changes --- doc/Integration.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/Integration.md b/doc/Integration.md index 3bda2d07..2556ebdb 100644 --- a/doc/Integration.md +++ b/doc/Integration.md @@ -202,16 +202,16 @@ function with the code to parse your sensor data and create a JSON string expect This example function expects that the sensor is sending 16 bits of humidity, 16 bits of temperature (in tenths of a degree) and 1 byte checksum. It uses only temperature, because, as stated above, Adafruit feeds are single value. Temperature sign is encoded in the 16th bit. -``` -fun(_Port, <<_Humid:16, Temp0:16, _Csum>>) -> # Point 1 -TSign = Temp0 band 16#8000, # Point 2 -TVal = Temp0 band 16#7FFF, # Point 3 -case TSign of # Point 4 +```erlang +fun(_Port, <<_Humid:16, Temp0:16, _Csum>>) -> % Point 1 +TSign = Temp0 band 16#8000, % Point 2 +TVal = Temp0 band 16#7FFF, % Point 3 +case TSign of % Point 4 0 -> Temp = TVal / 10; _ -> Temp = -(TVal / 10) end, -[H|_] = io_lib:format("~w", [Temp]), # Point 5 - <<"{\"value\":", (list_to_binary(H))/bytes, "}">> # Point 6 +[H|_] = io_lib:format("~w", [Temp]), % Point 5 + <<"{\"value\":", (list_to_binary(H))/bytes, "}">> % Point 6 end. ```