I want to display negative temperature on channel view

5 次查看(过去 30 天)
I am reading temperature data from DS18B20 and plotting to thingspeak graph on a channel. Positive temperatures show up correctly, but negative temperatures show only as values (above zero). How do I plot negative values? I have a LCD display which shows both positive and negative temperatures properly.

采纳的回答

Ardish Morawala
Ardish Morawala 2022-10-21
Hello Christopher,
I solved the problem. It was a stupid mistake on my part, in the coding. I used the processed 2's complement data (which is always seen as positive) instead of the raw data sentby DS1B20.
That is why the LCD always proper temperature (positive and negative) but the Data being uploaded to Thingspeak is always positive. This code follows the LCD display code.
I used the raw temperature data in two separate variables, one for the LCD code and one for the thingspeak code. This worked.
Regards.

更多回答(1 个)

Christopher Stapels
Christopher Stapels 2022-10-19
Here are a few ways to get negative numbers into ThingSpeak or to plot them in MATLAB.
https://api.thingspeak.com/update?api_key=xxxxxxxxxxxxxxxx&field1=-1
or in MATLAB visualization
plot(-10:0,-100:-90)
  2 个评论
Ardish Morawala
Ardish Morawala 2022-10-20
Hello Christopher,
I solved the problem. It was a stupid mistake on my part, in the coding. I used the processed 2's complement data (which is always seen as positive) instead of the raw data sentby DS1B20.
That is why the LCD always proper temperature (positive and negative) but the Data being uploaded to Thingspeak is always positive. This code follows the LCD display code.
I used the raw temperature data in two separate variables, one for the LCD code and one for the thingspeak code. This worked.
Regards.
Christopher Stapels
Christopher Stapels 2022-10-20
Thank you for clarifying. I thought I remembered that you had solved this, but I didnt find the other question right away. Can you put the explanation in an answer (button below) and accept it, just in case someone else happens upon this thread?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Act on Data 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by