I want to display negative temperature on channel view

조회 수: 5 (최근 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 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