I want to display negative temperature on channel view

4 ビュー (過去 30 日間)
Ardish Morawala
Ardish Morawala 2022 年 9 月 8 日
回答済み: Ardish Morawala 2022 年 10 月 21 日
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 Center および File ExchangeConfigure Accounts and Channels についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by